Solved

Using QueryPerformanceCounter in Perf Counter

Posted on 2004-04-15
4
423 Views
Last Modified: 2010-08-05
I am using QueryPerformanceCounter to determine the amount of time a function takes (transforming XSL templates), and applying that value to a PerformanceCounter object (AverageTimer32) using the following psuedo-code:
            _perfmonAvg = New PerformanceCounter("PG", "TimeToTransform", Me.ID.ToString, False)
            _perfmonBase = New PerformanceCounter("PG", "TimeToTransformBase", Me.ID.ToString, False)
            ' End If
            _perfmonAvg.RawValue = 0
            _perfmonBase.RawValue = 0

    Private Sub StartTime()
        QueryPerformanceCounter(_startTime)
    End Sub
    Private Sub UpdatePerformance()
        Try
            Dim _end As Int64
            QueryPerformanceCounter(_end)
            _timetotransform = _end - _startTime
            _perfmonAvg.IncrementBy(_timetotransform)
            _perfmonBase.Increment()
        Catch oE As Exception
        End Try

    End Sub

------------------------------
When I look at the performance counter, I get a value of .778 if the scale is set to 10,000.
I've looked at  http://support.microsoft.com/default.aspx?scid=kb;en-us;306978, but it doesn't answer my questions:
1) What is the .778 value in reference to seconds ? (ms, microsecs,ticks? )
2) Do I need to divide using QueryPerformanceFrequency to determine secs/ms?
3) what is the proper setting for the scale to make this read in ms?

Thanks Experts!

0
Comment
Question by:lrr81765
4 Comments
 
LVL 22

Accepted Solution

by:
_TAD_ earned 250 total points
ID: 10835711


I'm not quite certain, but it should be pretty easy to determine.  I mean, after all you are talking about powers of 10 here.  Did the process take 2 seconds or did it take 20 seconds?  and ticks... there are 60 ticks to a second, and there are 1,000 ms to second and 100,000 microseconds to a second



soooo... at a scale of 10,000 and you get .778

If it took approx. 7-8 seconds to complete, you are using ms

if it took a bare fraction of a second you are using microseconds or ticks


Based on your scale and your number I'd guess it to be ms
0
 
LVL 48

Assisted Solution

by:Mikal613
Mikal613 earned 250 total points
ID: 10835744
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now