I am using IA32_FIXED_CTR1 to read unhalted core cycles. CPUID leaf 0x0a tells me that these have width of 48 bits. I run rdmpc with exc = 0x40000001 to specify this fixed counter, and then grab eax and the first 16 bits of edx to get the cycle count.
However, just after system startup the value of edx is 65535, or 1111111111111111b. This seems incorrect; shouldn't it take a long time to count up to that value if it starts at zero? Additionally, multiple invocations of the program that reads the cycles (C++ source file attached) show that the lower bits of the count cycle in a matter of seconds - that is, running the program a second time produces a lower cycle count than the first. This shouldn't happen for a 48-bit counter if I am not mistaken.
I appreciate any advice as to why this is happening.
I am using an Intel Xeon x5650 processor with Ubuntu 12.04 LTS.