In general, I use time.time()
to get CPU time for some my codes, for example:
import time
t_start = time.time()
my_code()
t_end = time.time()
cpu_usage_time = t_end - t_start
But actually, I don't know whether the cpu_usage_time
is all used for my code or not, I think the actual time is less than or equal with cpu_usage_time
.
I want to know how to get actual CPU time for my code with Python3.x built-in modules or functions.
Thank you.