Re: Measuring cpu time using getrusage

2007-02-17 Thread Tim Schmielau
On Wed, 14 Feb 2007, Johann Schuster wrote:

> currently i'm trying to measure the cpu times for
> numerical algorithms written in C using two calls of
> getrusage() and then calculating the time difference.
> 
> According to the man page of getrusage i looked at the
> user time of my process. Surprisingly the measured user
> times vary strongly depending on the system load of the
> machine.
> A heavy system load nearly doubles the measured time
> for my routine.

Does your system have hyperthreading? (look at whether the siblings field 
in /proc/cpuinfo is greater than one)
If yes, there is no way to accurately measure runtimes because the 
(single-threaded) performance of your CPU depends on the other tasks 
running. Just disable hyperthreading for these measurements.

Tim
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Measuring cpu time using getrusage

2007-02-17 Thread Tim Schmielau
On Wed, 14 Feb 2007, Johann Schuster wrote:

 currently i'm trying to measure the cpu times for
 numerical algorithms written in C using two calls of
 getrusage() and then calculating the time difference.
 
 According to the man page of getrusage i looked at the
 user time of my process. Surprisingly the measured user
 times vary strongly depending on the system load of the
 machine.
 A heavy system load nearly doubles the measured time
 for my routine.

Does your system have hyperthreading? (look at whether the siblings field 
in /proc/cpuinfo is greater than one)
If yes, there is no way to accurately measure runtimes because the 
(single-threaded) performance of your CPU depends on the other tasks 
running. Just disable hyperthreading for these measurements.

Tim
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Measuring cpu time using getrusage

2007-02-14 Thread Johann Schuster
Hello,

currently i'm trying to measure the cpu times for
numerical algorithms written in C using two calls of
getrusage() and then calculating the time difference.

According to the man page of getrusage i looked at the
user time of my process. Surprisingly the measured user
times vary strongly depending on the system load of the
machine.
A heavy system load nearly doubles the measured time
for my routine.

Does anyone know a better way to measure the used
cpu cycles of a given process (or part of a program)
or can anyone give me a hint if i missed some important
fact.

Any help appreciated. Thank you in advance.


Johann Schuster
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Measuring cpu time using getrusage

2007-02-14 Thread Johann Schuster
Hello,

currently i'm trying to measure the cpu times for
numerical algorithms written in C using two calls of
getrusage() and then calculating the time difference.

According to the man page of getrusage i looked at the
user time of my process. Surprisingly the measured user
times vary strongly depending on the system load of the
machine.
A heavy system load nearly doubles the measured time
for my routine.

Does anyone know a better way to measure the used
cpu cycles of a given process (or part of a program)
or can anyone give me a hint if i missed some important
fact.

Any help appreciated. Thank you in advance.


Johann Schuster
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/