I have a code that looks like this:
%%time
import time
time.sleep(3)
When I executed this cell in the jupyter I got this output:
CPU times: user 791 µs, sys: 1.47 ms, total: 2.27 ms
Wall time: 3 s
My problem is that when I am putting sleep(3)
shouldn't the total time be 3sec instead of 2.27ms.
CPU times: user 791 µs, sys: 1.47 ms, total: 2.27 ms
Wall time: 3 s
CPU times
shows the time you used your CPU.Wall time
shows the real time elapsed since the beginning of the cell. This is the time you are interested in.
Try the following to see the difference:
%%time
time.sleep(3) #Assuming the time module was already imported
You never used your CPU, hence CPU Times is 0s
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With