‘system_time’ return
the sum of system and cpu time of the current process, don’t include sleep
time.
import time def process1(): time.sleep(2) if __name__=="__main__": time1=time.process_time() process1() time2=time.process_time() time3=time.time() process1() time4=time.time() print("Total CPU time : ",(time2-time1)) print("Total time including sleep time : ",(time4-time3))
Output
Total CPU time : 3.200000000000078e-05
Total time including sleep
time : 2.000080108642578
No comments:
Post a Comment