示例#1
0
        private static void InitializeCounters(object performanceCounters)
        {
            Type typeFromHandle = typeof(IExPerformanceCounter);

            foreach (PropertyInfo propertyInfo in performanceCounters.GetType().GetProperties())
            {
                if (typeFromHandle.IsAssignableFrom(propertyInfo.PropertyType))
                {
                    IExPerformanceCounter exPerformanceCounter = propertyInfo.GetValue(performanceCounters, null) as IExPerformanceCounter;
                    if (exPerformanceCounter != null)
                    {
                        exPerformanceCounter.RawValue = 0L;
                    }
                }
            }
        }
 public MovingAveragePerfCounter(IExPerformanceCounter perfCounter, int sampleSize)
 {
     this.perfCounter = perfCounter;
     this.samples     = new long[sampleSize];
 }