salutare,
daca procesorul stie de tsc
[EMAIL PROTECTED]:~/dev# cat xx.c
#include <stdio.h>
__inline__ unsigned long long int rdtsc()
{
unsigned long long int x;
__asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
return x;
}
int main()
{
int i;
for(i=0; i < 10; i++)
printf("%Lu\n", rdtsc());
return 0;
}
astia de la google zic asa:
rdtsc for Pentiums
For Pentiums, you can get the number of clock cycles elapsed since the
last reboot with the following C code (which executes the CPU instrution
named RDTSC):
Dorin Lazar wrote:
> On Monday 07 March 2005 09:07, Serghei Amelian wrote:
>
>>O posibilitate ar fi select().
>>struct timeval tv;
>>tv.tv_sec = 0;
>>tv.tv_usec = 1000;
>>select(0, NULL, NULL, NULL, &tv);
>
> Nici un ceas din Linux nu va da precizie mai buna decat 1/HZ secunde. Daca
> este cu un kernel patchuit va putea sa obtina precizie de 1 ms (parca 1000
> era valoarea maxima recomandata pentru HZ, nu?). Restul cam tine de domeniul
> RTLinux.
> O "anti-solutie" ar fi sa faca busy-waiting pana cand gettimeofday ii da un
> timp apropiat de ce vrea el. Dar habar n-am daca chestia asta chiar
> functioneaza.
> Dorin
>
> ---
> Detalii despre listele noastre de mail: http://www.lug.ro/
>
>
--
Ionut Spirlea, http://sgi.rdscv.ro/~ionuts/
"The number of the beast - vi vi vi" ... World Wide Web
---
Detalii despre listele noastre de mail: http://www.lug.ro/