I need to programmatically (.NET 3.5, C #) monitor a SQL Server 2008 machine through WMI. I want to measure the number of batch requests per second that the server receives; is that the tool Windows 7 Performance Monitor displays in the category SQL Server:SQL Statistics, Batch Requests/sec. If I track a server using this tool, I observe a baseline of zero when the server is idle, up to 100 or 200 when I hit it with some requests from my application.
Now, when I try to use WMI classes in .NET to get the same data, I only read zeros, no matter how hard I got to the server with the requests. From what I read on MSDN, some performance counters should not get instantly, but sampling is suggested. I could not find information about which counters fall into this category, i.e. Should sampling be used to measure batch requests per second? Also, what choice? I believe that the Windows performance analysis tool does some calculations behind the scenes to show the graphs it shows; I would like to get similar results. Did someone go through a similar experience and successfully solve it? Thank.
source
share