When I execute the following program and look at the performance counter the results don\'t make sense to me. The average value is zero and the min/max values are ~0.4 when I w
Mark Seemann explained the confusing source of the problem but I would like to provide a little bit of additional information.
If you want to set your AverageTimer32
performance counter from a TimeSpan
and not a Stopwatch
you can perform the following conversion:
var performanceCounterTicks = timeSpan.Ticks*Stopwatch.Frequency/TimeSpan.TicksPerSecond;
averageTimerCounter.IncrementBy(performanceCounterTicks);
averageTimerCounterBase.Increment();