PerformanceCounter Class

Represents an extension of the basic PerformanceCounter providing additional statistical logic.

Definition

Namespace: Gemstone.Diagnostics
Assembly: Gemstone.Diagnostics (in Gemstone.Diagnostics.dll) Version: 1.0.128 -- Release Build+d9d157c80da59365061f9bf4a5d1ecd0f0496e1b
public class PerformanceCounter : IDisposable
Inheritance
Object    PerformanceCounter
Implements
IDisposable

Example

This example shows how to create a performance counter for processor utilization:
C#
using System;
using System.Threading;
using Gemstone.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        PerformanceCounter counter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
        while (true)
        {
            Thread.Sleep(1000);
            counter.Sample();
            Console.WriteLine(string.Format("Last value: {0}", counter.LastValue));
            Console.WriteLine(string.Format("Minimum value: {0}", counter.MinimumValue));
            Console.WriteLine(string.Format("Maximum value: {0}", counter.MaximumValue));
            Console.WriteLine(string.Format("Average value: {0}", counter.AverageValue));
            Console.WriteLine(new string('-', 30));
        }
    }
}

Constructors

PerformanceCounter(String, String, String) Initializes a new instance of the PerformanceCounter class.
PerformanceCounter(String, String, String, String) Initializes a new instance of the PerformanceCounter class.
PerformanceCounter(String, String, String, String, String) Initializes a new instance of the PerformanceCounter class.
PerformanceCounter(String, String, String, String, String, Single, Boolean) Initializes a new instance of the PerformanceCounter class.

Properties

AliasName Gets or sets an alias name for the PerformanceCounter.
AverageValue Gets the average value from the samples of the BaseCounter.
BaseCounter Gets the PerformanceCounter object that this PerformanceCounter objects wraps.
LastValue Gets the last sample value from the samples of the BaseCounter.
LifetimeAverageValue Gets the average sample value over the entire lifetime of the BaseCounter.
LifetimeMaximumValue Gets the maximum sample value over the entire lifetime of the BaseCounter.
LifetimeSampleCount Gets the total values sampled over the entire lifetime of the BaseCounter.
MaximumValue Gets the maximum sample value from the samples of the BaseCounter.
MinimumValue Gets the minimum sample value from the samples of the BaseCounter.
SampleAdjuster Gets or sets an optional custom sample adjustment function. Can be used to apply linear adjustments to sampled values.
SampleFilter Gets or sets an optional custom sample filter function. Can be used to skip sampled values that are unreasonable.
Samples Gets a list of sampled values from the BaseCounter
SamplingWindow Gets or sets the number of samples to use to determine the LastValue, MinimumValue, MaximumValue and AverageValue.
ValueDivisor Gets or sets the divisor to be applied to the LastValue, MinimumValue, MaximumValue and AverageValue.
ValueUnit Gets or sets the measurement unit of LastValue, MinimumValue, MaximumValue and AverageValue

Methods

Dispose Releases all the resources used by the PerformanceCounter object.
Dispose(Boolean) Releases the unmanaged resources used by the PerformanceCounter object and optionally releases the managed resources.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Finalize Releases the unmanaged resources before the PerformanceCounter object is reclaimed by GC.
(Overrides ObjectFinalize)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Reset Resets the PerformanceCounter object to its initial state.
Sample Obtains a sample value from the BaseCounter.
ToStringReturns a string that represents the current object.
(Inherited from Object)

Fields

DefaultSamplingWindow Default number of samples over which statistical values are to be calculated.
DefaultValueDivisor Default divisor to be applied to the statistical value.
DefaultValueUnit Default measurement unit of the statistical values.

See Also