[Prev][Next][Index][Thread]
Re: measuring time
> From: Vishal Zinjuvadia <zvishal@ittc.ukans.edu>
> Subject: measuring time
>
> I am carrying out some performance test and I need to measure the
> time required to perform read/write operation on oskit. I am using freebsd
> socket libraries. I tried linking loskit_posix library and using
> gettimeofday() but the granularity offered by it is very low and does not
> meet the requirements. Is there any way I can have time measured upto
> microseconds in oskit ? I happened to come across a function fs_gettime()
> (described in section 9.7.6 of oskit doc) and wondered if I could use it.
> I didnot come across any use of this function in the examples directory in
> oskit distribution.
First off, that section of the documentation needs to be fixed. That code
has been deprecated.
Next, the highest resolution you can get is via the Pentium cycle timer,
which ticks off in cycles. Very handy and we use it to get measurements all
over the place. A code fragment:
#include <oskit/machine/proc_reg.h>
long long cycles;
foo()
{
unsigned long long before, after;
before = get_tsc();
do something;
after = get_tsc();
cycles += (after - before);
}
Lbs
----------------------------------------
Leigh B. Stoller
University of Utah - Flux Research Group
http://www.cs.utah.edu/~stoller
----------------------------------------