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

  • SEARCH
  • Home
  • 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 8267409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:31:00+00:00 2026-06-08T05:31:00+00:00

I have a simple monitoring application that is getting some values from PerfMon counters.

  • 0

I have a simple monitoring application that is getting some values from PerfMon counters. Even when testing on the local machine, it is taking over 30 seconds to create a new PerformanceCounter object.

using System;
using System.Diagnostics;

namespace test_slow_perfmon
{
    class Program
    {
        static void Main(string[] args)
        {
            Stopwatch w = new Stopwatch();

            w.Start();
            PerformanceCounter c = new PerformanceCounter("PhysicalDisk", "Avg. Disk Read Queue Length", "_Total", "localhost");
            w.Stop();
            Console.WriteLine(string.Format("Creating a counter took {0}ms", w.Elapsed.TotalMilliseconds));
        }
    }
}

Output from that indicates over 32s to create each counter.

What can I do (if anything) to speed up the creation of the counters?

  • 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-06-08T05:31:02+00:00Added an answer on June 8, 2026 at 5:31 am

    30 seconds sounds to me suspiciously like a timeout, indicating to me that this could be some sort of network issue.

    Try creating your perfmon counter using the constructor that doesn’t specify a hostname and see if that helps:

    PerformanceCounter c = new PerformanceCounter("PhysicalDisk", "Avg. Disk Read Queue Length", "_Total");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have built a simple website monitoring application using Indy TIdhttp component. I want
I have a few little scripts that I use for monitoring some aspects of
I have a monitoring application in python 2.6 that calculates the number of entries
I have simple application that need to tune. I am wondering if there is
I have simple php validation form that is halfway working. If you leave the
I have simple win service, that executes few tasks periodically. How should I pass
We have a requirement to design a monitoring application for our Windows client machines
We have a Java web application and we'd like to set up some basic
We're trying to get some usage metrics on a VB6 application that we are
Hi, I have a WCF service in IIS7 that communicates with a winform application

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.