consider the following example:
import hotshot
import hotshot.stats
import time
def test_sleep():
time.sleep(1)
def main():
prof = hotshot.Profile("lol.prof")
prof.runcall(test_sleep)
prof.close()
stats = hotshot.stats.load("lol.prof")
stats.sort_stats("time", "calls")
stats.print_stats(20)
if __name__ == "__main__":
main()
I got this conclusion:
debian:# python lol.py
1 function calls in 1.000 CPU seconds
Ordered by: internal time, call count
ncalls tottime percall cumtime percall filename:lineno(function)
1 1.000 1.000 1.000 1.000 lol.py:6(test_sleep)
0 0.000 0.000 profile:0(profiler)
I expect that I will have 0sec processor time and 1sec wall time.
I expect 1 processor to be second in the case of a busy cycle, not in the case of sleep.
Can someone explain why I get such results?
Thank!
source
share