I have created a custom performance counter using the following code:
public class PerfCounter
{
private PerformanceCounter perfCounter;
PerfCounter(string CategoryName, string CounterName)
{
perfCounter = new PerformanceCounter(CategoryName, CounterName, false);
perfCounter.BeginInit();
}
public void IncrementBy(long value)
{
perfCounter.IncrementBy(value);
}
public void Reset()
{
//what should I add here?
}
}
Everything works fine but I don't know how to Reset the counter. Can anyone help me?
Do this:
public void Reset()
{
perfCounter.RawValue = 0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With