|   | Performance | 
 Inheritance Hierarchy
Inheritance Hierarchy
         Syntax
SyntaxThe PerformanceCounter type exposes the following members.
 Constructors
Constructors| Name | Description | |
|---|---|---|
|  | 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
Properties| Name | Description | |
|---|---|---|
|  | 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
Methods| Name | Description | |
|---|---|---|
|  | 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. | 
|  | Equals | Determines 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) | 
|  | GetHashCode | Serves as the default hash function. (Inherited from Object) | 
|  | GetType | Gets the Type of the current instance. (Inherited from Object) | 
|  | MemberwiseClone | Creates 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. | 
|  | ToString | Returns a string that represents the current object. (Inherited from Object) | 
 Fields
Fields| Name | Description | |
|---|---|---|
|   | 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. | 
 Extension Methods
Extension Methods| Name | Description | |
|---|---|---|
|  | GetEnumValueOrDefault | Gets the enumeration constant for value, if defined in the enumeration, or a default value. (Defined by EnumExtensions) | 
|  | GetEnumValueOrDefaultT | Gets the enumeration constant for this value, if defined in the enumeration, or a default value. (Defined by EnumExtensions) | 
 Example
Exampleusing System; using System.Threading; using GSF.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)); } } }
 See Also
See Also