Hi,
I'm measuring the timing of my (RT-) processes using gethrtime(). Basically, the
timing loop looks like this:
hrtime_t a,b,c;
pthread_make_periodic_np(pthread_self(),gethrtime(), periodicity);
while (1)
{
a = gethrtime();
pthread_wait_np();
b = gethrtime();
// do something useful
c = gethrtime();
// send a,b,c to user space via RTfifo
}
When comparing (b-a), which should be the time between context-switch-out and
switch-in, I am getting unreasonable values - 42806400 ns - no matter how i set the
period time of the process. I have tried with a very slow 99 Hz and a more reasonable
9900 Hz, the results are the same... what is happening here?
I am running this on an SMP machine, albeit only with one processor (866MHz PIII).
gethrtimeres() reports 32. The linux kernel is compiled for SMP, so I guess an APIC is
used for timing.
I tried to read the TSC with the following piece of code,
extern __inline__ unsigned long long int get_rdtsc()
{
unsigned long long int x;
__asm__ __volatile__ (".byte 0x0f, 0x31" : "=A" (x)) ;
return x;
}
but I get even more bogus values using that. Is the TSC reset by linux or rtlinux
during for example scheduling?
Regards, Jonas
______________________________________________________________________
Jonas Persson E-mail: [EMAIL PROTECTED]
Project Manager, M.Sc C.Sc&E http://www.comsys.se/
Comsys AB Phone: +46-(0)46-286 3500
Forskningsbyn IDEON Fax: +46-(0)46-286 3505
S-223 70 Lund, Sweden
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/