printf mnemonic for the value returned by rdtsc/rdpmc
From: Vasanth Venkatachalam (spamtrap_at_crayne.org)
Date: 10/26/04
- Next message: Robert Wessel: "Re: Chaning IOPL level..."
- Previous message: Vasanth Venkatachalam: "question about serializing instructions"
- Next in thread: Tim Roberts : "Re: printf mnemonic for the value returned by rdtsc/rdpmc"
- Reply: Tim Roberts : "Re: printf mnemonic for the value returned by rdtsc/rdpmc"
- Reply: KVP: "Re: printf mnemonic for the value returned by rdtsc/rdpmc"
- Reply: Phil Carmody: "Re: printf mnemonic for the value returned by rdtsc/rdpmc"
- Reply: Grumble: "Re: printf mnemonic for the value returned by rdtsc/rdpmc"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 25 Oct 2004 22:42:54 +0000 (UTC)
I'm running a Pentium M under linux.It has two 40 bit performance countesr
and 64 bit timestamp register (like all other cpus of the pentium 6 family).
I am getting funny values when I print out the value returned by an rdpmc or
rdtsc instruction. I'm not sure if I'm doing the printing correctly.
In my test program I define the macro readpmc as
#define readpmc(counter, val) \
__asm__ __volatile__("rdpmc" \
: "=A" (val) \
: "c" (counter))
readtsc is defined similarly.
Now say I write the hex value 0x24 into performance counter 0 . This is a 40
bit counter. I then do
unsigned long long result;
readpmc(0, result);
printf(" %x %llu %llx\n", result, result, result);
The value it prints out is: "24 154618824960 2400000900". The first
value is correct because it is what I wrote into the counter. The second
value is gibberish, and the very first two digits of the third value contain
what I wrote but the bottom digits have a 900 which is coming out of
nowhere.
I get the same inconsistency when printing out the value of the 64 bit
timestamp register.
Can anyone explain this disparity? What IS the proper printf mnemonic to
print out the value that's in a 40 bit performance counter or 64 bit
timestamp register?
- Next message: Robert Wessel: "Re: Chaning IOPL level..."
- Previous message: Vasanth Venkatachalam: "question about serializing instructions"
- Next in thread: Tim Roberts : "Re: printf mnemonic for the value returned by rdtsc/rdpmc"
- Reply: Tim Roberts : "Re: printf mnemonic for the value returned by rdtsc/rdpmc"
- Reply: KVP: "Re: printf mnemonic for the value returned by rdtsc/rdpmc"
- Reply: Phil Carmody: "Re: printf mnemonic for the value returned by rdtsc/rdpmc"
- Reply: Grumble: "Re: printf mnemonic for the value returned by rdtsc/rdpmc"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]