I want to measure run time of a Python program and compare it to /usr/bin/time. The script, t.py:
import psutil, time,
startSecs = psutil.Process(os.getpid()).create_time()
print("startup took %.3fs" % (time.time() - startSecs))
run as:
/usr/bin/time -f 'wall=%e' python3 t.py
output:
startup took 0.822s
wall=0.03
where 0.8s is quite obviously wrong, not only because of the wall=0.03, but because there is no noticeable wait of nearly a second. How come?