简体   繁体   English

使用具有属性的性能计数器

[英]Using Performance Counters with Attributes

I'm looking for a way to simplify creating and using Performance Counters in our applications in order to run load tests and get the application specific information using the counters . 我正在寻找一种简化在我们的应用程序中创建和使用性能计数器的方法,以便运行负载测试并使用计数器获取特定于应用程序的信息。 It would be nice to do it using attributes. 使用属性做它会很好。 For example when a programmer puts an appropriate attribute on a method the method execution time is measured. 例如,当程序员在方法上放置适当的属性时,测量方法执行时间。 So I'm looking for an attribute I can inherit that is activated by FW before and right after method call. 所以我正在寻找一个我可以继承的属性,它在方法调用之前和之后被FW激活。 Is there any attribute like this? 有这样的属性吗?

Thanks a lot, Dani 非常感谢,Dani

Edit: After some research I have found a PerformanceCounterCallHandlerAttribute from the EntLib. 编辑:经过一些研究后,我从EntLib中找到了一个PerformanceCounterCallHandlerAttribute It seems to me that it is what I need but I'd like to know how exactly it works. 在我看来,这是我需要的,但我想知道它究竟是如何工作的。 I could not uderstand it from the documentaion I have found. 我无法从我找到的文件中理解它。 Any help will be appreciated. 任何帮助将不胜感激。

Check this . 检查一下 Not exactly what you are asking for but I believe same approach will work for you. 不完全是你所要求的,但我相信同样的方法对你有用。 It is all about handling before, after and on error events. 这完全是关于错误事件之前,之后和之后的处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM