Message148390
_clocks = ['CLOCK_PROCESS_CPUTIME_ID', 'CLOCK_MONOTONIC_RAW',
'CLOCK_MONOTONIC', 'CLOCK_REALTIME']
Beware, we're mixing CPU time and wall-clock time:
$ ./python -c "from time import *; id = CLOCK_REALTIME; t = clock_gettime(id); sleep(1); print(clock_gettime(id) - t)"
1.0011036396026611
$ ./python -c "from time import *; id = CLOCK_PROCESS_CPUTIME_ID; t = clock_gettime(id); sleep(1); print(clock_gettime(id) - t)"
9.480300000003217e-05
Right now, timeit measures wall-clock time:
"""
On either platform, the default timer functions measure wall clock time, not the CPU time. [...] On Unix, you can use clock() to measure CPU time.
"""
With CLOCK_PROCESS_CPUTIME_ID:
- depending on the platform, we'll measure either wall-clock time or CPU time
- preemtion, blocking syscalls, etc won't be accounted for (so, for example, I/O-related tests will be meaningless) |
|
Date |
User |
Action |
Args |
2011-11-26 10:56:01 | neologix | set | recipients:
+ neologix, georg.brandl, pitrou |
2011-11-26 10:56:01 | neologix | set | messageid: <1322304961.75.0.728095247439.issue13481@psf.upfronthosting.co.za> |
2011-11-26 10:56:01 | neologix | link | issue13481 messages |
2011-11-26 10:56:00 | neologix | create | |
|