Measuring CPU time with getrusage

From: Marco Almeida
Date: Sat Jan 16 2010 - 09:04:22 EST



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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/