Skip to contentSkip to conversation

why is rdtsc reporting wrong cpu cycles?

DISCUSSION Marco Correia 2 participants 2 messages Jan 3, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

I'm using the following function for getting the number of CPU cycles elapsed since I rebooted:

/* Read Timer Stamp Counter */
unsigned long long int rdtsc(void)
{
unsigned long long int x;

__asm__ volatile(".byte 0x0f,0x31" : "=A" (x)); return x;
}

The problem is that the value I get dividing by my processor frequency (my computer is a 650Mhz toshiba satellite pro 4340) is giving me about 1 hour and I'm using the computer for about 4 fours.

Am I forgetting something obvious? I already googled around but I came to the conclusion that only new P4 M processors are able to change speed.

I'm sorry if this is not the place to ask.

Thanks
Marco

ps: Please CC me as I'm not subscribed

Signature · 1 line
Marco Correia <[email protected]>
#1 lore raw

Hi Marco,

Quoted 6 lines · Marco Correia

The problem is that the value I get dividing by my processor frequency (my computer is a 650Mhz toshiba satellite pro 4340) is giving me about 1 hour and I'm using the computer for about 4 fours.

Am I forgetting something obvious? I already googled around but I came to the conclusion that only new P4 M processors are able to change speed.

Perhaps it supports throttling. My mobile athlon supports this : 10000 times a second, it is stopped for a certain amount of time, then resumed. Depending on the throttling factor, I can even here it !

Cheers,
Willy