Select PerformanceCounterType

c# performance counter
windows performance monitor

Here is the question. I am developing a method named CreateCounters that will create performance counters for an application. The method includes the following code.

void CreateCounters()
         var counters = new CounterCreateationDataCollection();
         var ccdCounter1 = new CounterCreationData
             CounterName = "Counter1";
             CounterType = PerformanceCounterType.SampleFraction;
         var ccdCounter2 = new CounterCreationData
             CounterName = "Counter2";
             // need insert PerformanceCounterType
         PerformanceCounterCategory.Create("Contoso","Help dtring",
         PerformanceCounterCategoryType.MultiInstance, counters);

I need to ensure that Counter1 is available for use in Windows Performance Monitor (PerfMon). Which code segment should you insert?

There are four choices.

A. CounterType = PerformanccCounterType.RawBase
B. CounterType = PerformanceCounterType.AverageBase
C. CounterType = PerformanceCounterType.SampleBase
D. CounterType = PerformanceCounterType.CounterMultiBase

I don't know which one and why?

See this:

there is a table in there showing that PerformanceCounterType.SampleFraction needs a denomonator of type PerformanceCounterType.SampleBase

(and RawFraction needs RawBase etc)

Select PerformanceCounterType, Select PerformanceCounterType. 发布于 2020-04-23 11:53:04. Here is the question. I am developing a method named CreateCounters that will create� Examples. The following code example demonstrates the use of the PerformanceCounter class to create and use an AverageCount64 counter type. The example creates categories, sets up counters, collects data from the counters, and calls the CounterSampleCalculator class to interpret the performance counter data.

C. CounterType = PerformanceCounterType.SampleBase

An Introduction To Performance Counters, When starting using PerformanceCounterType. Now right-click on " Performance counters" and select "Add new category" to add a new� To do so, right-click anywhere in performance monitor and select Properties and then Data. Select the counter of which you require to change the scale, and change the factor with the dropdown listbox, and click OK. You can also change the color and thickness of the curve drawn for that counter here.

The answer is, as all other answers here on stackoverflow point out, option c with the SampleBase counter type.

Unfortunately, I think it's not enough just to refer to the Microsoft documentation for the PerformanceCounterType since the important lines for this specific question in handling performance counters are easy to miss. So did I and needed to find this question and another blogpost until I recognized them.

So for clarification why c is the correct answer here is the explanation taken from the remarks section of the Microsoft documentation:

When instrumenting applications (creating and writing custom performance counters), you might be working with performance counter types that rely on an accompanying base counter that is used in the calculations. The base counter must be immediately after its associated counter in the CounterCreationDataCollection collection your application uses. The following table lists the base counter types with their corresponding performance counter types.

Base counter type  Performance counter types
AverageBase        AverageTimer32, AverageCount64
CounterMultiBase   CounterMultiTimer, CounterMultiTimerInverse, CounterMultiTimer100Ns, CounterMultiTimer100NsInverse
RawBase            RawFraction
SampleBase         SampleFraction

Select counter type, For more information, see WMI Performance Counter Type. SQL Server System Counter. Select this option to pick from counters that are gathered via standard� The Performance Monitor (a tool provided by default in Windows OS) snap-in can be used to view the performance data in real time. To start this tool, click on the Start menu and click on "Run".

I think that the Correct Answer is C. CounterType = PerformanceCounterType.SampleBase

WMI Performance Counter Types, The performance counter type designates a formula required to obtain calculated performance counters. These are the same counter types� Column name Data type Description; object_name: nchar(128) Category to which this counter belongs. counter_name: nchar(128) Name of the counter. To get more information about a counter, this is the name of the topic to select from the list of counters in Use SQL Server Objects.

Performance Monitor Instance Counters - MSDN, CounterType =PerformanceCounterType. In Add Counters dialog, select Performance object as TestCategory, select Test Counter in the� The performance Category is "SpidertracksDataListener", the value is Processed Per second. I can get the value from performance monitor with the following steps. Start -> Run "perfmon". Click the plus button. Select Performance object "Spidertracks_DataListener". Select "ProcessedPerSecond" from the counter list.

Count rate of change, Select the ACounterDemo performance object, CountPerSecond counter, and _Total instance. Choose Add, close CounterType = PerformanceCounterType. Download source - 6.05 KB; Introduction. Setting up and using Performance Counters with the .NET API requires a bit of setup and configuration. This article presents a generalized code block which can be used in a common scenario for simple performance benchmarking.

PerformanceCounterType :: Chapter 29. System.Diagnostics :: Part , PerformanceCounterType in the .NET Framework SDK Documentation for complete details. public enum PerformanceCounterType { NumberOfItemsHEX32 = 0,� Select Servers -> your computer name -> Performance Counters; Right click Performance Counters and select "Create New Category" In the dialog box, enter the name of the Category and any description you would like in the Category Description text box. In the counter list builder frame click "New" to add a new Performance Counter.

  • hi @Andreas! wellcome to stackoverflow! Could yo add what is the foundament to select the option that are you selecting? It would be helpful
  • SampleBase :a base counter that stores the number of sampling interrupts taken and is used as a denominator in the sampling fraction. The sampling fraction is the number of samples that were 1 (or true) for a sample interrupt. Check that this value is greater than zero before using it as the denominator in a calculation of Sample Fraction.