I’m moving some instrumentation into PostSharp aspects, basically the code which is incrementing the timing counters looks something like the following:
MyPerformanceCounter.IncrementBy(elapsed);
MyPerformanceCounterBase.Increment();
This works fine and I see the correct values getting updated in Perfmon (MyPerformanceCounter is an AverageTimer32, MyPerformanceCounterBase is an AverageBase).
However whilst doing this I noticed that there were already a couple of instrumentation aspects floating around:
and this very similar one from the PostSharp examples
In both of them they only have the first line – the increment on the AverageBase base is missing. If I try this then the counter stops working (no errors, but nothing visible in perfmon).
Am I missing something? It seems to be too much of a coincidence for both of these implementations to not need the explicit update to the base counter. I’m using Vista 64 on machine where I’m testing this.
In the case of the PostSharp web site, I (shamefully) think I did not really test them, and now, looking at the documentation, I see you’re probably right.