PHP
·
发表于 5年以前
·
阅读量:8298
以下代码段用于计算执行一段代码所需的时间。
import time
start_time = time.time()
a,b = 5,10
c = a+b
end_time = time.time()
time_taken = (end_time- start_time)*(10**6)
print("Time taken in micro_seconds:", time_taken) # Time taken in micro_second