Hi,
I've seen several threads on this subject, but haven't (yet) run
across one that answers my specific questions. This should be really
easy for someone, so here goes:
I'm running some numerical simulations under Ubuntu, and using Python
as my scripting language to automatically manage input and output. I
need to have a precise performance measurement (CPU time) of how long
it takes to run my simulations.
Right now I have something like:
stime = time.time()
subprocess.call(["./mysim","args"])
ftime = time.time()
print ftime-stime
However, time.time() only gives wall-clock time, so I'm also measuring
the time it takes to run other processes running at the same time.
What I'd rather have is:
stime = time.clock()
subprocess.call(["./mysim","args"])
ftime = time.clock()
print ftime-stime
But this, of course, usually outputs 0, because time.clock() does not
count the CPU ticks of the subprocess.
So, long story short, I need to get CPU time of something I call using
subprocess.call(). I don't want to have to profile my code, since it
will significantly reduce computation time.
Thanks for the advice.
Kevin
--
http://mail.python.org/mailman/listinfo/python-list