Link to home
Start Free TrialLog in
Avatar of lrr81765
lrr81765

asked on

Using QueryPerformanceCounter in Perf Counter

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!

ASKER CERTIFIED SOLUTION
Avatar of _TAD_
_TAD_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Mikal613
Mikal613
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial