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 8168203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:26:36+00:00 2026-06-06T20:26:36+00:00

How can I define and use two AverageTimer32 performance counters in one application (.exe)?

  • 0

How can I define and use two AverageTimer32 performance counters in one application (.exe)?

Additional Notes:
I am trying so measure spent time on different parts of an operation.

I have an AverageTimer32 performance counter and an AverageBase. It works.

Now I want to add a second AverageTimer32 performance counter. It does not work even if I add another AverageBase counter. I think I am mistaken about something. Code sample is really appreciated.

This is the different parts of the code:

_AverageDuration = new PerformanceCounter();
_AverageDuration.CategoryName = CategoryName;
_AverageDuration.CounterName = "average time per operation";
_AverageDuration.MachineName = ".";
_AverageDuration.ReadOnly = false;

_AverageDurationBase = new PerformanceCounter();
_AverageDurationBase.CategoryName = CategoryName;
_AverageDurationBase.CounterName = "average time per operation base";
_AverageDurationBase.MachineName = ".";
_AverageDurationBase.ReadOnly = false;
...
CounterCreationDataCollection counters = new CounterCreationDataCollection();
...
CounterCreationData avgDuration = new CounterCreationData();
avgDuration.CounterName = "average time per operation";
avgDuration.CounterHelp = "Average duration per operation execution";
avgDuration.CounterType = PerformanceCounterType.AverageTimer32;
counters.Add(avgDuration);

CounterCreationData avgDurationBase = new CounterCreationData();
avgDurationBase.CounterName = "average time per operation base";
avgDurationBase.CounterHelp = "Average duration per operation execution base";
avgDurationBase.CounterType = PerformanceCounterType.AverageBase;
counters.Add(avgDurationBase);
...
PerformanceCounterCategory.Create(CategoryName, "Category for Receiver", PerformanceCounterCategoryType.Unknown, counters);
...
AverageDuration.IncrementBy(performanceCounterwatch.ElapsedTicks);
AverageDurationBase.Increment();
  • 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-06T20:26:38+00:00Added an answer on June 6, 2026 at 8:26 pm

    The order of adding them is critical. You must add the Average, then its corresponding base, then the second average and then the second corresponding base.

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

Sidebar

Related Questions

How can I use two devices in order to improve for example the performance
How can I define two dimensional dynamic array? If I want to use List<>,
When I use the Ember Router, how can I define actions in the template
In Oracle / SQL Server I can use the WITH keyword to define a
In Asp.net MVC Razor we can use the _ViewStart.cshtml file to define the default
When we define routes in routes.rb using the name like map.some_link .We can use
In C#, you can use the implicit keyword to define an implicit user-defined type
I am trying to define two conditions for a WHERE clause: WHERE Date =
I'm curious as to whether one can define a Java class purely using a
I would like to use same ComplexType in two different WSDLs. How to define

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.