Message11662
As implemented, time.clock() is giving you wall-clock time. I'm sure that's the best we could do at the time it was written (looks old).
Interesting question. If you want a work-around, I found this worked:
>>> from java.lang.management import ManagementFactory as MF
>>> tb = MF.getThreadMXBean()
>>> tb.isThreadCpuTimeSupported()
True
>>> tb.getCurrentThreadCpuTime()
3421875000L
>>> tb.getCurrentThreadCpuTime()*1e-9
3.484375
>>> tb.getCurrentThreadCpuTime()*1e-9
3.5
>>> tb.getCurrentThreadCpuTime()*1e-9
3.515625
It might be useful to re-implement time.clock() this way, if it is available on all major platforms. |
|
Date |
User |
Action |
Args |
2017-11-19 22:23:23 | jeff.allen | set | messageid: <1511130203.01.0.213398074469.issue2643@psf.upfronthosting.co.za> |
2017-11-19 22:23:23 | jeff.allen | set | recipients:
+ jeff.allen, zsd |
2017-11-19 22:23:22 | jeff.allen | link | issue2643 messages |
2017-11-19 22:23:22 | jeff.allen | create | |
|