Wednesday, October 22, 2003


Source: Greg Linwood
www.bainlinwood.com

After struggling with & losing sleep over Win32 performance APIs, the PHD (Performance Data Helper) libraries & fiddling with WMI scripts over the years, I was recently pleased to see the relative ease with which one can code against the .Net framework's Diagnostics namespace. Totally awesome - the framework works against NT4, Win2K, XP & Win2003 with a single code base, designed against a nice, easy to use class model. The temptation was just too great, so I set to work on porting my old SQL Monitoring toolset to the framework.

Then, disaster hit - the .Net framework's System.Diagnostics.PerformanceCounter.NextValue() method fails to return meaningful values for some of my prime target counters:

% Disk Time
% Disk Read Time
% Disk Write Time
% Idle Time

After searching the newgroup archives, I came up with a recent post in microsoft.public.dotnet.framework.performance which directed me to Microsoft Knowledge Base Article - 324548 - “BUG: NextValue Method of .NET PerformanceCounter Object Returns Zero“ @ http://support.microsoft.com/default.aspx?scid=kb;en-us;324548, published immediately after the newsgroup post.

I love the ease with which the .Net framework has simplified accessing performance counter data (especially creating / writing to counters) but beware of this bug. I hope a fix comes out for it asap becuase in the mean time, I'll need to release a code path branch to handle these counters in unmanaged code which nearly defeats the purpose of using the framework in the first place.


Cheers - & happy Perfmon'ing!

Greg Linwood
www.bainlinwood.com

 

[WebLogs @ SqlJunkies.com]
11:19:26 AM    trackback []     Articulate []