473,325 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Performance counters and LARGE_INTEGER values

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!
Nov 17 '05 #1
6 2068
Hi Bob Altman,
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
http://blog.kalmbachnet.de/
Nov 17 '05 #2
"Jochen Kalmbach" <no********************@holzma.de> wrote in message
news:Xn*********************************@207.46.24 8.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
Nov 17 '05 #3
Hi Tim Robinson,
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
http://blog.kalmbachnet.de/
Nov 17 '05 #4
"Jochen Kalmbach" <no********************@holzma.de> wrote in message
news:Xn*********************************@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
Nov 17 '05 #5
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
parametric eq, xfeed, reverb: all on a ppc
Nov 17 '05 #6
Hi ,
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
http://blog.kalmbachnet.de/
Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David Mitchell | last post by:
Hello group, I'm trying to write code to test an application we're developing. This application needs to store its own performance data in the registry, and we'd like to be storing quite a...
12
by: Gustavo L. Fabro | last post by:
Greetings! Getting straight to the point, here are the results of my experiment. I've included my comments and questions after them. The timing: (The total time means the sum of each line's...
2
by: David Wagner | last post by:
Hi, I am looking at wanting to configure and manage some Performance Monitor logs through a C# application. Specifically, I want to be able to define and configure named performance log...
0
by: Christopher Attard | last post by:
Hi, I need to create a dialog like the 'Add Counters' dialog box in perfmon. I'm using the System.Diagnostics namespace class in .NET and I've managed to do it. The problem arises when I'm...
7
by: James | last post by:
Hi Has anybody had any experience of ASP.Net performance counters not updating. In the performance monitor application when I try to add the groups ASP.NET and ASP.NET Applications the...
0
by: Salvador | last post by:
Hi, I have created a service, which installer installs 5 performance counters as well. Then the service instances these counters and interact with them. If I check the event viewer I receive...
8
by: NAdir | last post by:
Hi, thank you for your help. My VB.Net application contains a document that the user can refresh at any time. The refresh works fine and needs to loop through few datatables (hundreds of rows)....
1
by: jvn | last post by:
I am experiencing a particular problem with performance counters. I have created a set of classes, that uses System.Diagnostics.PerformanceCounter to increment custom performance counters (using...
0
by: Dev - | last post by:
Hi, Iam monitoring the performance of WCF Application. I have added the WCF Counters ServiceModelEndPoint/Operation/Service. Of these three counters, when i start the perfmon the values for...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.