递增 AverageTimer32 性能计数器
我将一些检测转移到 PostSharp 方面,基本上增加计时计数器的代码如下所示:
MyPerformanceCounter.IncrementBy(elapsed);
MyPerformanceCounterBase.Increment();
这工作正常,我看到 Perfmon 中更新了正确的值(MyPerformanceCounter 是 AverageTimer32,MyPerformanceCounterBase 是 AverageBase)。
然而,在执行此操作时,我注意到已经存在一些仪器方面的问题:
在这两个示例中,它们都只有第一行 - AverageBase 基数上的增量丢失了。如果我尝试这样做,那么计数器将停止工作(没有错误,但在 perfmon 中看不到任何内容)。
我错过了什么吗?这两种实现都不需要显式更新基本计数器,这似乎太巧合了。我正在测试这个的机器上使用 Vista 64。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
就 PostSharp 网站而言,我(可耻地)认为我没有真正测试它们,现在,查看文档,我发现您可能是对的。
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.