9
我曾嘗試使用下面的代碼創建一個自定義的性能計數器:如何重置自定義的性能計數器
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?
}
}
一切工作正常,但我不知道如何重置計數器。誰能幫我?
或許這將幫助? http://stackoverflow.com/questions/9195851/reset-performance-counter-from-command-line – Freddy 2012-03-06 14:21:09