HighTechTalks DotNet Forums  

How to override RawValue of PerformanceCounter?

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


Discuss How to override RawValue of PerformanceCounter? in the Dotnet Framework (Performance) forum.



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

Default How to override RawValue of PerformanceCounter? - 11-28-2007 , 11:59 PM






My application needs a "UpTime" counter to track elapsed seconds since
the application is active. My preference is to record the time to
"m_activeDate" when the application turns to active; and have one
performance counter to calculate elapsed seconds by (DateTime.Now() -
m_activeDate).TotalSeconds.

However, PerformanceCounter.RawData property is not virtual. So, I
cannot make a subclass of PerformanceCounter and override this
property. I have to have my application to set the RawData every
seconds. This is not good. I believe that calculation should happen
only when performance counter is retrieved.

Is there any better way to do it?

Thanks,
-Morgan

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 - 2008, Jelsoft Enterprises Ltd.