.NET Framework Class Library  

PerformanceCounterType Enumeration

Specifies the formula used to calculate the NextValue method for a PerformanceCounter instance.

[Visual Basic]
<Serializable>
Public Enum PerformanceCounterType
[C#]
[Serializable]
public enum PerformanceCounterType
[C++]
[Serializable]
__value public enum PerformanceCounterType
[JScript]
public
   Serializable
enum PerformanceCounterType

Remarks

Some counter types represent raw data, while others represent calculated values that are based on one or more counter samples. The following categories classify the types of counters available.

When sampling performance counter data, using a counter type that represents an average can make raw data values meaningful for your use. For example, the raw data counter NumberOfItems64 can expose data that is fairly random from sample to sample. The formula for an average calculation of the values that the counter returns would be (X0 +X 1 +…+X n)/n, where each X i is a raw counter sample.

Rate counters are similar to average counters, but more useful for situations in which the rate increases as a resource is used. A formula that quickly calculates the average is ((Xn -X 0)/(T n -T 0))/ frequency, where each X i is a counter sample and each T i is the time that the corresponding sample was taken. The result is the average usage per second.

Note   Unless otherwise indicated, the time base is seconds.

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 SampleCounter

SampleFraction

Members

Member name Description
AverageBase A base counter that is used in the calculation of time or count averages, such as AverageTimer32 and AverageCount64. Stores the denominator for calculating a counter to present "time per operation" or "count per operation".
AverageCount64 An average counter that shows how many items are processed, on average, during an operation. Counters of this type display a ratio of the items processed to the number of operations completed. The ratio is calculated by comparing the number of items processed during the last interval to the number of operations completed during the last interval.

Formula: (N1 -N 0)/(B 1 -B 0), where N 1 and N 0 are performance counter readings, and the B 1 and B 0 are their corresponding AverageBase values. Thus, the numerator represents the numbers of items processed during the sample interval, and the denominator represents the number of operations completed during the sample interval.

Counters of this type include PhysicalDisk\ Avg. Disk Bytes/Transfer.

AverageTimer32 An average counter that measures the time it takes, on average, to complete a process or operation. Counters of this type display a ratio of the total elapsed time of the sample interval to the number of processes or operations completed during that time. This counter type measures time in ticks of the system clock.

Formula: ((N1 -N 0)/F)/(B 1 -B 0), where N 1 and N 0 are performance counter readings, B 1 and B 0 are their corresponding AverageBase values, and F is the number of ticks per second. The value of F is factored into the equation so that the result can be displayed in seconds. Thus, the numerator represents the numbers of ticks counted during the last sample interval, F represents the frequency of the ticks, and the denominator represents the number of operations completed during the last sample interval.

Counters of this type include PhysicalDisk\ Avg. Disk sec/Transfer.

CounterDelta32 A difference counter that shows the change in the measured attribute between the two most recent sample intervals.

Formula: N1 -N 0, where N 1 and N 0 are performance counter readings.

CounterDelta64 A difference counter that shows the change in the measured attribute between the two most recent sample intervals. It is the same as the CounterDelta32 counter type except that is uses larger fields to accomodate larger values.

Formula: N1 -N 0, where N 1 and N 0 are performance counter readings.

CounterMultiBase A base counter that indicates the number of items sampled. It is used as the denominator in the calculations to get an average among the items sampled when taking timings of multiple, but similar items. Used with CounterMultiTimer, CounterMultiTimerInverse, CounterMultiTimer100Ns, and CounterMultiTimer100NsInverse.
CounterMultiTimer A percentage counter that displays the active time of one or more components as a percentage of the total time of the sample interval. Because the numerator records the active time of components operating simultaneously, the resulting percentage can exceed 100 percent.

This counter is a multitimer. Multitimers collect data from more than one instance of a component, such as a processor or disk. This counter type differs from CounterMultiTimer100Ns in that it measures time in units of ticks of the system performance timer, rather than in 100 nanosecond units.

Formula: ((N1 - N 0)/ (D 1 - D 0)) x 100/ B, where N 1 and N 0 are performance counter readings, D 1 and D 0 are their corresponding time readings in 100-nanosecond units, and the variable B denotes the base count for the monitored components (using a base counter of type CounterMultiBase). Thus, the numerator represents the portions of the sample interval during which the monitored components were active, and the denominator represents the total elapsed time of the sample interval.

CounterMultiTimer100Ns A percentage counter that shows the active time of one or more components as a percentage of the total time of the sample interval. It measures time in 100 nanosecond (ns) units.

This counter type is a multitimer. Multitimers are designed to monitor more than one instance of a component, such as a processor or disk.

Formula: ((N1 - N 0)/ (D 1 - D 0)) x 100/ B, where N 1 and N 0 are performance counter readings, D 1 and D 0 are their corresponding time readings in 100-nanosecond units, and the variable B denotes the base count for the monitored components (using a base counter of type CounterMultiBase). Thus, the numerator represents the portions of the sample interval during which the monitored components were active, and the denominator represents the total elapsed time of the sample interval.

CounterMultiTimer100NsInverse A percentage counter that shows the active time of one or more components as a percentage of the total time of the sample interval. Counters of this type measure time in 100 nanosecond (ns) units. They derive the active time by measuring the time that the components were not active and subtracting the result from multiplying 100 percent by the number of objects monitored.

This counter type is an inverse multitimer. Multitimers are designed to monitor more than one instance of a component, such as a processor or disk. Inverse counters measure the time that a component is not active and derive its active time from the measurement of inactive time

Formula: (B - ((N1 - N 0)/ (D 1 - D 0))) x 100, where the denominator represents the total elapsed time of the sample interval, the numerator represents the time during the interval when monitored components were inactive, and B represents the number of components being monitored, using a base counter of type CounterMultiBase.

CounterMultiTimerInverse A percentage counter that shows the active time of one or more components as a percentage of the total time of the sample interval. It derives the active time by measuring the time that the components were not active and subtracting the result from 100 percent by the number of objects monitored.

This counter type is an inverse multitimer. Multitimers monitor more than one instance of a component, such as a processor or disk. Inverse counters measure the time that a component is not active and derive its active time from that measurement.

This counter differs from CounterMultiTimer100NsInverse in that it measures time in units of ticks of the system performance timer, rather than in 100 nanosecond units.

Formula: (B- ((N1 - N 0)/ (D 1 - D 0))) x 100, where the denominator represents the total elapsed time of the sample interval, the numerator represents the time during the interval when monitored components were inactive, and B represents the number of components being monitored, using a base counter of type CounterMultiBase.

CounterTimer A percentage counter that shows the average time that a component is active as a percentage of the total sample time.

Formula: (N1 - N 0)/ (D 1 - D 0), where N 1 and N 0 are performance counter readings, and D 1 and D 0 are their corresponding time readings. Thus, the numerator represents the portions of the sample interval during which the monitored components were active, and the denominator represents the total elapsed time of the sample interval.

CounterTimerInverse A percentage counter that displays the average percentage of active time observed during sample interval. The value of these counters is calculated by monitoring the percentage of time that the service was inactive and then subtracting that value from 100 percent.

This is an inverse counter type. Inverse counters measure the time that a component is note active and derive the active time from that measurement. This counter type is the same as CounterTimer100NsInv except that it measures time in units of ticks of the system performance timer rather than in 100 nanosecond units.

Formula: (1- ((N1 - N 0)/ (D 1 - D 0))) x 100, where the numerator represents the time during the interval when the monitored components were inactive, and the denominator represents the total elapsed time of the sample interval.

CountPerTimeInterval32 An average counter designed to monitor the average length of a queue to a resource over time. It shows the difference between the queue lengths observed during the last two sample intervals divided by the duration of the interval. This type of counter is typically used to track the number of items that are queued or waiting.

Formula: (N1 - N 0)/ (D 1 - D 0), where the numerator represents the number of items in the queue and the denominator represents the time elapsed during the last sample interval.

CountPerTimeInterval64 An average counter that monitors the average length of a queue to a resource over time. Counters of this type display the difference between the queue lengths observed during the last two sample intervals, divided by the duration of the interval. This counter type is the same as CountPerTimeInterval32 except that it uses larger fields to accommodate larger values. This type of counter is typically used to track a high-volume or very large number of items that are queued or waiting.

Formula: (N1 - N 0)/ (D 1 - D 0), where the numerator represents the number of items in a queue and the denominator represents the time elapsed during the sample interval.

ElapsedTime A difference timer that shows the total time between when the component or process started and the time when this value is calculated.

Formula: (D0 - N 0)/ F, where D 0 represents the current time, N 0 represents the time the object was started, and F represents the number of time units that elapse in one second. The value of F is factored into the equation so that the result can be displayed in seconds.

Counters of this type include System\ System Up Time.

NumberOfItems32 An instantaneous counter that shows the most recently observed value. Used, for example, to maintain a simple count of items or operations.

Formula: None. Does not display an average, but shows the raw data as it is collected.

Counters of this type include Memory\Available Bytes.

NumberOfItems64 An instantaneous counter that shows the most recently observed value. Used, for example, to maintain a simple count of a very large number of items or operations. It is the same as NumberOfItems32 except that it uses larger fields to accommodate larger values.

Formula: None. Does not display an average, but shows the raw data as it is collected.

NumberOfItemsHEX32 An instantaneous counter that shows the most recently observed value in hexadecimal format. Used, for example, to maintain a simple count of items or operations.

Formula: None. Does not display an average, but shows the raw data as it is collected.

NumberOfItemsHEX64 An instantaneous counter that shows the most recently observed value. Used, for example, to maintain a simple count of a very large number of items or operations. It is the same as NumberOfItemsHEX32 except that it uses larger fields to accommodate larger values.

Formula: None. Does not display an average, but shows the raw data as it is collected

RateOfCountsPerSecond32 A difference counter that shows the average number of operations completed during each second of the sample interval. Counters of this type measure time in ticks of the system clock.

Formula: (N1 - N 0)/ ( (D 1 -D 0)/ F), where N 1 and N 0 are performance counter readings, D 1 and D 0 are their corresponding time readings, and F represents the number of ticks per second. Thus, the numerator represents the number of operations performed during the last sample interval, the denominator represents the number of ticks elapsed during the last sample interval, and F is the frequency of the ticks. The value of F is factored into the equation so that the result can be displayed in seconds.

Counters of this type include System\ File Read Operations/sec.

RateOfCountsPerSecond64 A difference counter that shows the average number of operations completed during each second of the sample interval. Counters of this type measure time in ticks of the system clock. This counter type is the same as the RateOfCountsPerSecond32 type, but it uses larger fields to accommodate larger values to track a high-volume number of items or operations per second, such as a byte-transmission rate.

Formula: (N1 - N 0)/ ( (D 1 -D 0)/ F), where N 1 and N 0 are performance counter readings, D 1 and D 0 are their corresponding time readings, and F represents the number of ticks per second. Thus, the numerator represents the number of operations performed during the last sample interval, the denominator represents the number of ticks elapsed during the last sample interval, and F is the frequency of the ticks. The value of F is factored into the equation so that the result can be displayed in seconds.

Counters of this type include System\ File Read Bytes/sec.

RawBase A base counter that stores the denominator of a counter that presents a general arithmetic fraction. Check that this value is greater than zero before using it as the denominator in a RawFraction value calculation.
RawFraction An instantaneous percentage counter that shows the ratio of a subset to its set as a percentage. For example, it compares the number of bytes in use on a disk to the total number of bytes on the disk. Counters of this type display the current percentage only, not an average over time.

Formula: (N0/ D 0) x 100, where D 0 represents a measured attribute (using a base counter of type RawBase) and N0 represents one component of that attribute.

Counters of this type include Paging File\% Usage Peak.

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 SampleCounter or SampleFraction.
SampleCounter An average counter that shows the average number of operations completed in one second. When a counter of this type samples the data, each sampling interrupt returns one or zero. The counter data is the number of ones that were sampled. It measures time in units of ticks of the system performance timer.

Formula: (N1 - N 0)/ ((D 1 - D 0)/ F), where N 1 and N 0 are performance counter readings, D 1 and D 0 are their corresponding SampleBase values, and F is the number of ticks that elapse in one second. Thus, the numerator represents the number of operations completed and the denominator represents elapsed time in units of ticks of the system performance timer. F is factored into the equation so that the result can be displayed in seconds.

SampleFraction A percentage counter that shows the average ratio of hits to all operations during the last two sample intervals.

Formula: ((N1 - N 0)/ (D 1 - D 0)) x 100, where the numerator represents the number of successful operations during the last sample interval, and the denominator represents the change in the number of all operations (of the type measured) completed during the sample interval, using counters of type SampleBase.

Counters of this type include Cache\Pin Read Hits %.

Timer100Ns A percentage counter that shows the active time of a component as a percentage of the total elapsed time of the sample interval. It measures time in units of 100 nanoseconds (ns). Counters of this type are designed to measure the activity of one component at a time.

Formula: (N1 - N 0)/ (D 1 - D 0) x 100, where the numerator represents the portions of the sample interval during which the monitored components were active, and the denominator represents the total elapsed time of the sample interval.

Counters of this type include Processor\ % User Time.

Timer100NsInverse A percentage counter that shows the average percentage of active time observed during the sample interval.

This is an inverse counter. Counters of this type calculate active time by measuring the time that the service was inactive and then subtracting the percentage of active time from 100 percent.

Formula: (1- ((N1 - N 0)/ (D 1 - D 0))) x 100, where the numerator represents the time during the interval when the monitored components were inactive, and the denominator represents the total elapsed time of the sample interval.

Counters of this type include Processor\ % Processor Time.

Requirements

Namespace: System.Diagnostics

Platforms: Windows NT Server 4.0, Windows NT Workstation 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System (in System.dll)

See Also

System.Diagnostics Namespace | PerformanceCounter