HighTechTalks DotNet Forums  

Customer performance counter which tracks the duration of a proces

Dotnet Framework (Performance) microsoft.public.dotnet.framework.performance


Discuss Customer performance counter which tracks the duration of a proces in the Dotnet Framework (Performance) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
ejstembler
 
Posts: n/a

Default 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
process?

For instance, something like this:

counter.ProcessBegan;
myProcess();
counter.ProcessCompleted;

Reply With Quote
  #2  
Old   
Ranjan
 
Posts: n/a

Default 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?
r.


"ejstembler" <ejstembler (AT) discussions (DOT) microsoft.com> wrote

Quote:
Is there a PerformanceCounterType I can use for tracking the duration of a
process?

For instance, something like this:

counter.ProcessBegan;
myProcess();
counter.ProcessCompleted;



Reply With Quote
  #3  
Old   
Justin Rogers
 
Posts: n/a

Default 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
great.
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
overcome
the DateTime granularity, but that shouldn't normally be a problem.

The most accurate method is probably GetThreadTimes, a Win32 API, because you
can
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
yields
execution. The problem here is you can't track thread dead time.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getthreadtimes.asp

For actual processes, you might want to check out System.Diagnostics. They have
some
Process APIs that should help you get timings, including the raising of some
process related
events.

For truly high performant counters that get around the granularity troubles, you
shold probably
try, QueryPerformanceCounter and QueryPerformanceFrequency.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/queryperformancecounter.asp

Hope this helps at least a bit.


--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

"Ranjan" <ranjan (AT) proteans (DOT) com> wrote

Quote:
Why dont you use DateTime.Now and check this?
r.


"ejstembler" <ejstembler (AT) discussions (DOT) microsoft.com> wrote in message
news76ECADD-0110-423F-B774-EC515084F93D (AT) microsoft (DOT) com...
Is there a PerformanceCounterType I can use for tracking the duration of a
process?

For instance, something like this:

counter.ProcessBegan;
myProcess();
counter.ProcessCompleted;





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.