[Beowulf] Time measurement

Mark Hahn hahn at physics.mcmaster.ca
Tue Aug 2 14:06:30 EDT 2005


> 1) /usr/bin/time  prog   : this includes all the communcation, i/o ,
> loading overhead etc

I always push users to do this, first.  those overheads may seem irrelevant,
but since you cannot avoid them, it is most honest to include them.

> 2) include start_time , end_time code in the program : this won't
> include the communication , i/o , loading etc overhead.

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;
}


> what method is usually used ?  thanks  

ultimately, what matters is how long it takes you to get a result.
that's an end-to-end kind of measure, not a micro-measurement,
which is why "time myjob" is the best.  actually, most parallel environments
have a queueing system, and it almost certainly already does job timing,
so you only need to get the info.

regards, mark hahn.

_______________________________________________
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf



More information about the Beowulf mailing list