So I can use time.clock()
to measure the running time of a function call:
>>> def f() :
a = time.clock()
range(pow(10,8))
b = time.clock()
print a,b
>>> f()
0.143698 8.345905
But now if just call time.clock()
repeatedly from the interactive shell:
>>> time.clock()
0.075492
>>> time.clock()
0.075931
>>> time.clock()
0.076354
>>> time.clock()
0.076754
>>> time.clock()
0.077132
...
What is the meaning of these numbers?
And now if I do this:
>>> def g() :
a = time.clock()
time.sleep(10)
b = time.clock()
print a,b
>>> g()
8.361528 8.361625
Ok I guess that sleep
is not counted in processing time, so the two numbers are very close. But what does 8.361528 correspond to?
I did read the documentation, but I still don't understand:
Help on built-in function clock in module time:
clock(...) clock() -> floating point number
Return the CPU time or real time since the start of the process or since the first call to clock(). This has as much precision as the system records.