> 
> > Hi,
> > 
> > This is Sreenivasa from Honeywell. I am currently working on RTOE and have
> > to do the performance test of RTOE. That is, the time needed for each API
> > calls. Since the time taken for the execution of the APIs are in
> > micro/nano seconds, I need functions in C which gives time in Micro or
> > nano seconds. But there is no such functions in C which gives time in
> > micro or nano seconds.

Most hardware platforms can't give you times in nanoseconds any way - at best
you can expect time precission in the range of one microsecond - even if the
TSC may have a resolution of 32ns the reading of the timer takes some time 
so the timesatmp is only exact to at best 1 microsecond.

 And also if we go for software time functions, they
> > themselves take some time to execute. So we are planning to go for using
> > internal counters provided by the system. I came to know that you also
> > worked on similar lines by visiting the following site:
> > http://www.realtimelinux.org/archives/realtime/20007/0010.html Is there
> > any way to access the internal counters? And if so, can you please help me
> > regarding this. 
>  

You can read the TSC on X86 (you did not specify which arch you are talking
about so I'll assume X86...) with the rdtsc assembly instruction (if the
board has a TSC). If you are on a system with a 8254 you are in trouble if
you need nano second resolution (one tick on the 8254 is 838ns but you need
a few cycles to read it so you will probably get no better than 10us time 
stamp resolution). 

__inline__ unsigned long long int hwtime(void)
{
        unsigned long long int x;
        __asm__("rdtsc\n\t" :"=A" (x));
        return x;
}


hofrat
-- [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/

Reply via email to