[Beowulf] Time measurement

Stuart Midgley sdm900 at gmail.com
Thu Aug 4 01:30:18 PDT 2005

Of course, if your scheduler/queue system preempts jobs then the wall  
time is meaningless (unless it stops while your job has been  
suspended).  So using walltime within your code to determine load  
balance etc. can be lead to very poor performance.

We tell users to look at the time the queue returns for your job.   
This includes all startup time/io/finish time and doesn't include the  
time you may have been suspended for.


> I find that mature codes usually have timing built in for various
> phases of their execution.  users who know how to use the code will
> be familiar with what the phases mean, why they change with different
> configurations, etc.
> personally, I would use gettimeofday if I wanted to do measurements
> of small sections of code.  overhead is fairly low and resolution is
> microseconds.  if you're trying to measure something which only takes
> microsecond, or for which a syscall's overhead is too high, you  
> probably
> need to do something radically different anyway.  here are two useful
> functions I use a lot:
> #include <sys/time.h>
> double gtod() {
>     struct timeval tv;
>     gettimeofday(&tv,0);
>     return tv.tv_sec + 1e-6 * tv.tv_usec;
> }
> typedef unsigned long long u64;
> static inline u64 rdtsc() {
>     u64 tsc;
>     __asm__ __volatile__("rdtsc" : "=A" (tsc));
>     return tsc;
> }

Dr Stuart Midgley
sdm900 at gmail.com

More information about the Beowulf mailing list