On 09Apr2012 02:00, Victor Stinner <victor.stin...@gmail.com> wrote: | > I personally have a need for one potentially different clock -- to | > measure short intervals for benchmarks and profiling. This might be | > called time.performancetimer()? | | I deferred this topic because it is unclear to me if such timer has to | count elapsed time during a sleep or not. For example, time.clock() | does on UNIX, whereas it doesn't on Windows. You may need two clocks | for this: | * time.perf_counter(): high-resolution timer for benchmarking, count | time elasped during a sleep
For POSIX, sounds like CLOCK_MONOTONIC_RAW to me. | * time.process_time(): High-resolution (?) per-process timer from the | CPU. (other possible names: time.process_cpu_time() or | time.cpu_time()) POSIX offers CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID that seem to suit this need, depending on your threading situation (and what you're measuring). | On Windows, GetProcessTimes() has not a "high-resolution": it has a | accuracy of 1 ms in the best case. This page: http://msdn.microsoft.com/en-us/library/windows/desktop/ms683223%28v=vs.85%29.aspx says "100-nanosecond time units". Am I going to the wrong place to learn about these functions? -- Cameron Simpson <c...@zip.com.au> DoD#743 http://www.cskk.ezoshosting.com/cs/ I distrust a research person who is always obviously busy on a task. - Robert Frosch, VP, GM Research _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com