Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1109333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:13:02+00:00 2026-05-17T02:13:02+00:00

I need to programmatically (.NET 3.5, C#) monitor a SQL Server 2008 machine through

  • 0

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 is receiving; this is what the Windows 7 Performance Monitor tool will show you under the SQL Server:SQL Statistics category, Batch Requests/sec counter. If I monitor the server using this tool, I observe a baseline of zero when the server is idle, going up to 100 or 200 when I hit it with some queries from my application.

Now, when I try to use the WMI classes in .NET to obtain the same data, I only read zeros, no matter how much I hit the server with queries. From what I have read on MSDN, some performance counters are not supposed to be retrieved instantaneously, but a sampling process is suggested. I could not find any information on which counters fall into this category, i.e. should I use sampling to measure batch requests per second? Also, what kind of sampling? I imagine that the Windows Performance Monitor tool is doing some calculations behind the scenes to show the graphs that it shows; I would like to obtain similar results. Anyone has gone through a similar experience and solved it successfully? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:13:02+00:00Added an answer on May 17, 2026 at 2:13 am

    Yes, that’s accurate. It is up to your code to do the same thing that Perfmon does: query the performance counter once a second to get a meaningful value. You’ll need a timer or (ugh) call Sleep(). Using the PerformanceCounter class is the better way to do this btw, WMI is not cheap. That also gives you access to the PerformanceCounter property which tells you what kind of counter it is. Doesn’t really matter, you know you need the timer anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to programmatically parse and transform ASP.NET webform pages. It's a requirement that
A few more details. I need to programmatically (Winforms, VB.NET) check if a site
I've a requirement that I need to read an excel sheet programmatically using asp.net/C#
I want to write a wizard in .net which programmatically generates Visual Studio Solution
How can I restart a windows service programmatically in .NET? Also, I need to
In our ASP.NET application, we need to programmatically access (read/Write) a shared location that
I need to display the .NET Compact Framework version number on the screen. I
I need to check programmatically (in .NET) whether a given user (domain account) is
I've got an arbitrary list of .NET assemblies. I need to programmatically check if
How do I programmatically read an incoming email with .NET. I need a method

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.