| By Derek Ferguson | Article Rating: |
|
| January 12, 2004 12:00 AM EST | Reads: |
11,821 |
Those of you who were offended by my past two editorials criticizing Linux - and who believe in instant karma - will take particular delight in the story I am about to relate.
On a recent project, I was given the task of creating a feature that would allow for the real-time monitoring of Windows performance counters, similar to the functionality available via the desktop Perfmon tool. After reviewing the .NET Framework SDK documentation, I became convinced that I should use the classes available in the System.Diagnostics namespace, as opposed to those in the System.Management namespace, with which I was already familiar.
Initially, I was rather pleased with the results of my decision. In less than a week, I had built what I took to be a robust implementation on top of what I then perceived as rock-solid and easy-to-use base library classes - most notably the PerformanceCounter class.
The first little burbles I heard back from my QA engineers were all very positive. I was reassured, but oh, how quickly my joy turned to sorrow!
The second batch of comments indicated that some of the counters were returning zero, even when the desktop Perfmon tool indicated that nonzero data was available. I searched my code in vain for errors I might have made in the use of this class.
I greeted the next development with a decided degree of ambivalence. It turned out - according to Microsoft KnowledgeBase Article #324548 (http://support.microsoft.com/) - that invalid counters are a known bug in the PerformanceCounter class! I am told that this bug has been fixed in Whidbey - good work, Microsoft!
Never missing an opportunity to kick me when I'm down, fate dealt me yet another blow. Concurrency testing with my new tool indicated that calls to the NextValue method on PerformanceCounter were blocking each other.
In my case, I was calling this method every five seconds in a Web service application. And so - every five seconds - all users of my application experienced a pause of approximately two seconds while the PerformanceCounter value was retrieved!
Ultimately, I was able to resolve this issue by creating a small database to cache these values. My problem is solved - but it caused me to think:
- Why weren't these little "issues" clearly documented?
- Why no fix plans or workarounds?
- If .NET merely wraps native Win32 APIs, what's the point?
This Issue Is X-Rated...
...because we're focusing on XML this month! (Sorry if you got your hopes up!) Enjoy our usual outstanding coverage with articles covering everything from XML security to the new XML-handling features in Whidbey.
Please send feedback to derek@sys-con.com.
Published January 12, 2004 Reads 11,821
Copyright © 2004 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Derek Ferguson
Derek Ferguson, founding editor and editor-in-chief of .Net Developer's Journal, is a noted technology expert and former Microsoft MVP.
- Kindle 2 vs Nook
- Confessions of a Ulitzer Addict
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Infrastructure-as-a-Service Will Mature in 2010: Microsoft's David Chou
- Windows 7 – Microsoft’s First Step to the Cloud
- Cloud Expo and the End of Tech Recession
- Jill Tummler Singer, Deputy CIO of CIA, Keynotes at GovIT Expo
- Reality Check at the Cloud Computing Expo
- Visual Studio 2010 Is Cloud Friendly
- Fired SCO CEO Fires Back
- Kindle 2 vs Nook
- The Difference Between Web Hosting and Cloud Computing
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Confessions of a Ulitzer Addict
- Wave on Ulitzer: Confessions of a Google Wave Fanboy
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- Cloud Computing Best Practices
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Infrastructure-as-a-Service Will Mature in 2010: Microsoft's David Chou
- Eval JavaScript in a Global Context
- Windows 7 – Microsoft’s First Step to the Cloud
- Google Maps and ASP.NET
- Crystal Reports XI & How It Has Changed
- Converting VB6 to VB.NET, Part I
- Creating Controls for.NET Compact Framework in Visual Studio 2005
- Where Are RIA Technologies Headed in 2008?
- How to Write High-Performance C# Code
- AJAX World RIA Conference & Expo Kicks Off in New York City
- Implementing Tab Navigation with ASP.NET 2.0
- i-Technology Photo Exclusive: Bill Gates & Steve Jobs In "Nerds"
- .NET Archives: Getting Reacquainted with the Father of C#
- i-Technology Viewpoint: "SOA Sucks"
- Programmatically Posting Data to ASP .NET Web Applications



























