Solved

Using QueryPerformanceCounter in Perf Counter

Posted on 2004-04-15
4
418 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

19 Experts available now in Live!

Get 1:1 Help Now