?
Solved

Using QueryPerformanceCounter in Perf Counter

Posted on 2004-04-15
4
Medium Priority
?
459 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
2 Comments
 
LVL 22

Accepted Solution

by:
_TAD_ earned 1000 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 1000 total points
ID: 10835744
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

850 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