2245 |
2245 |
2246 # os.times module computes the user time and system time spent by |
2246 # os.times module computes the user time and system time spent by |
2247 # child's processes along with real elapsed time taken by a process. |
2247 # child's processes along with real elapsed time taken by a process. |
2248 # This module has one limitation. It can only work for Linux user |
2248 # This module has one limitation. It can only work for Linux user |
2249 # and not for Windows. |
2249 # and not for Windows. |
2250 test.started = os.times() |
2250 test.started_times = os.times() |
2251 if self._firststarttime is None: # thread racy but irrelevant |
2251 if self._firststarttime is None: # thread racy but irrelevant |
2252 self._firststarttime = test.started[4] |
2252 self._firststarttime = test.started_times[4] |
2253 |
2253 |
2254 def stopTest(self, test, interrupted=False): |
2254 def stopTest(self, test, interrupted=False): |
2255 super(TestResult, self).stopTest(test) |
2255 super(TestResult, self).stopTest(test) |
2256 |
2256 |
2257 test.stopped = os.times() |
2257 test.stopped_times = os.times() |
2258 |
2258 |
2259 starttime = test.started |
2259 starttime = test.started_times |
2260 endtime = test.stopped |
2260 endtime = test.stopped_times |
2261 origin = self._firststarttime |
2261 origin = self._firststarttime |
2262 self.times.append( |
2262 self.times.append( |
2263 ( |
2263 ( |
2264 test.name, |
2264 test.name, |
2265 endtime[2] - starttime[2], # user space CPU time |
2265 endtime[2] - starttime[2], # user space CPU time |