On Thu, 2003-05-29 at 15:23, jacob robbins wrote:
I'm a little green at time measurement facilities
available in linux,
In my host, I would like to be able to measure how much time each
individual LADPSA plugin takes. Assuming I do realtime work with the
smallest buffer sizes my system can handle, what options are available
to me to measure time on this small scale? I know that the typical
system calls time and gettimeofday have resolution of 10 ms, which is
too big for this purpose. Is there any way to do this? Is there a
high-res time howto?
The Pentium Time Stamp Counter is often used for this purpose. It can be
found in Intel and compatible CPUs from Pentium on up. The rdtsc
assembler command is usually used for this purpose which reads the
elapsed CPU cycles, giving you a resolution of 1/CPU_MHz of second
resolution (not including the overhead of the rdtsc and other
instructions for processing its value). A function like:
void rdtsc(unsigned int *lsi, unsigned int *msi)
{
__asm__ ("rdtsc" : "=a" (*lsi), "=d" (*msi));
}
will fetch the time stamp counter into two 32 bit integers, lsi will be
the least significant integer, msi will be the most significant.
-jacob robbins.....
The lowlatency utility and FluidSynth are a couple of programs that have
code that uses this. Cheers.
Josh Green