[quoted text, click to view] "Jochen Kalmbach" <nospam-Jochen.Kalmbach@holzma.de> wrote in message news:Xns961FB8C254827JochenKalmbachholzm@207.46.248.16... >> 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! > > 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...
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
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!
Hi Bob Altman, [quoted text, click to view] > 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!
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
Hi Tim Robinson, [quoted text, click to view] >>> 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! >> >> 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... > > > 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.
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
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
[quoted text, click to view] "Jochen Kalmbach" <nospam-Jochen.Kalmbach@holzma.de> wrote in message news:Xns96204D8537AD9JochenKalmbachholzm@127.0.0.1... [...] >> 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. > > I just wanted to show that in the fastes possible implementation (RDTSC), > it will take 95 years to become negative!
A fair point :). /me goes and tests Jochen's theory -- Tim Robinson MVP, Windows SDK
Hi , [quoted text, click to view] > But the TSC can be user-set to any value, at > any time. Not that you'd want to, but anyone > (typically) could.
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
JK- [Mon, 21 Mar 2005 22:28:33 -0800]: [quoted text, click to view] >Not 100% true...
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
Don't see what you're looking for? Try a search.
|