Customer performance counter which tracks the duration of a proces - 10-29-2004 , 01:00 PM
Is there a PerformanceCounterType I can use for tracking the duration of a
For instance, something like this:
Re: Customer performance counter which tracks the duration of a proces - 10-30-2004 , 08:05 AM
Why dont you use DateTime.Now and check this?
"ejstembler" <ejstembler (AT) discussions (DOT) microsoft.com> wrote
Re: Customer performance counter which tracks the duration of a proces - 10-30-2004 , 12:08 PM
If the *process* is a function you are running, then the DateTime suggestion is
That is the same method used by most of the testing harnesses and performance
harnesses that people tend to write. The method has to be sufficiently long to
the DateTime granularity, but that shouldn't normally be a problem.
The most accurate method is probably GetThreadTimes, a Win32 API, because you
tell how long the thread actually executed. This is key, since a thread may be
in a non
executable state after a context switch to a higher priority thread, or when it
execution. The problem here is you can't track thread dead time.
For actual processes, you might want to check out System.Diagnostics. They have
Process APIs that should help you get timings, including the raising of some
For truly high performant counters that get around the granularity troubles, you
try, QueryPerformanceCounter and QueryPerformanceFrequency.
Hope this helps at least a bit.
DigiTec Web Consultants, LLC.
"Ranjan" <ranjan (AT) proteans (DOT) com> wrote
|Thread Tools||Search this Thread|