Skip to contentSkip to conversation

Measuring CPU time with getrusage

DISCUSSION Marco Almeida 1 participant 1 message Jan 16, 2010

lore
Share & tools
lore
#0 lore raw

Hi,

I'm trying to measure the CPU time of several algorithms (some written in C others in Python) by using getrusage() after wait() for the child process to end.

On a machine with hypterthreading, the measured user times depend a lot on the system load of the machine. A heavy system load sometimes increases the measured time by 10x!

Is there a better way to measure the used CPU time of a given process (or part of a program) or have I missed some important fact?

Any help appreciated.

Thanks,
Marco