views:

21

answers:

1

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:

This one by Marcin Kaluza

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.

+1  A: 

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.

Gael Fraiteur
Ah, OK that clears that up then - thanks for looking into it!
FinnNk