On Friday 16 February 2001 12:40, Alex Lin wrote:
> Hi all,
>
> Can someone give me a simple example how can I get a higher resolution
> time without RTLinux? I just want to compare the latency between the
> regular linux procedure and RTLinux procedure.

Do you need something like "interrupts", or just an accurate source of 
timestamps?

For the former, apply the UTIME patch, or use the RTC device to generate 
timing for your thread. Audio cards can also be "abused" at time base 
generators in this way.

If you just need timestamps and have a Pentium or better x86 CPU, the easiest 
way is probably to read the TSC. It counts core clock cycles, is 64 bits wide 
and is read with a single machine code instruction. Here's a macro to do that:

---8<----------------------------------------------------------
__inline__ unsigned long long int rdtsc(void)
{
        unsigned long long int x;
        __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
        return x;
}
---------------------------------------------------------->8---

Grab the CPU clock from /proc/cpuinfo; the "cpu MHz" line, to translate into 
more useful units.


//David

.- M A I A -------------------------------------------------.
|      Multimedia Application Integration Architecture      |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------> http://www.linuxaudiodev.com/maia -'
.- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`--------------------------------------> [EMAIL PROTECTED] -'
-- [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/

Reply via email to