Groups | Blog | Home
all groups > visual c > march 2005 >

visual c : Performance counters and LARGE_INTEGER values


Tim Robinson
3/20/2005 12:00:00 AM
[quoted text, click to view]


To be exact, QPC/QPF use different counters under different circumstances.
On my system, the clock used for these functions is much slower than the CPU
clock; I believe it's using some clock on the motherboard. If you think
about the multi-CPU case, RDTSC stops making sense.

--
Tim Robinson
MVP, Windows SDK

Bob Altman
3/20/2005 8:56:56 AM
Hi all,

QueryPerformanceCounter returns a LARGE_INTEGER, which the documentation
states is equivalent to a signed 64-bit integer. My question is, can
QueryPerformanceCounter return negative values, or is its output restricted
to positive values? TIA!

Jochen Kalmbach
3/20/2005 9:09:49 AM
Hi Bob Altman,

[quoted text, click to view]

QueryperformanceCounter internaly sometimes uses the RDTSC instruction. And
this value is an unsigned 64-bit value. Therefor if you interpret this
value as signed, it might become negative...


BUT: On current processor speeds (3GHz) it will take about 95 years of a
continuous running CPU to reach the "negative" value.

--
Greetings
Jochen

My blog about Win32 and .NET
Jochen Kalmbach
3/20/2005 10:35:36 PM
Hi Tim Robinson,

[quoted text, click to view]

I just wanted to show that in the fastes possible implementation (RDTSC),
it will take 95 years to become negative!

--
Greetings
Jochen

My blog about Win32 and .NET
hel NO[at]SPAM 40th.com
3/21/2005 6:45:04 PM
But the TSC can be user-set to any value, at
any time. Not that you'd want to, but anyone
(typically) could.

--
40th Floor - Software @ http://40th.com/
iPlay : the ultimate audio player for PPCs
mp3,mp4,m4a,aac,ogg,flac,wav,play & record
Tim Robinson
3/21/2005 8:12:23 PM
[quoted text, click to view]

A fair point :).

/me goes and tests Jochen's theory

--
Tim Robinson
MVP, Windows SDK

Jochen Kalmbach
3/21/2005 10:28:33 PM
Hi ,

[quoted text, click to view]

Not 100% true...

<quote>
When the WRMSR instruction is used to write to the time-stamp
counter, only the low order 32-bits of the time-stamp counter can be
written to, and the highorder 32 bits cleared to all 0s.
</quote>

--
Greetings
Jochen

My blog about Win32 and .NET
hel NO[at]SPAM 40th.com
3/22/2005 1:00:34 AM
JK- [Mon, 21 Mar 2005 22:28:33 -0800]:
[quoted text, click to view]

Right you are ... not the full 64 bits since the P6,
apparently all 64 in the P5. Do you have a P5 to
try? I've got some...on the wall. Smart move in
any case.

--
40th Floor - Software @ http://40th.com/
iPlay : the ultimate audio player for PPCs
mp3,mp4,m4a,aac,ogg,flac,wav,play & record
AddThis Social Bookmark Button