Solved

Using QueryPerformanceCounter in Perf Counter

Posted on 2004-04-15
4
439 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 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