使用仪器模型进行性能调优

发布于 2024-07-14 09:20:33 字数 283 浏览 5 评论 0原文

如果我使用此处描述的检测模型来分析 .Net 应用程序性能,这意味着分析工具将更改要分析的可执行文件的可执行代码以插入性能测量代码? 那么我原来的可执行代码被修改了?

http://msdn.microsoft.com/en-us /library/ms242753(VS.80).aspx

问候, 乔治

If I use instrumentation model as described here to profile .Net application performance, it means the profile tool will change the executable code of the to be profiled executable to insert performance measure code? So my original executable code is modified?

http://msdn.microsoft.com/en-us/library/ms242753(VS.80).aspx

regards,
George

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

御弟哥哥 2024-07-21 09:20:33

是的; 已检测的代码与未检测的代码不同。 这意味着您必须对结果稍微小心 - 但大多数分析器都能合理地将您的注意力吸引到重要的部分上。 我在采样选项方面从来没有什么运气——不过,仪器通常很有用。 就我个人而言,我喜欢 jetBrains 产品。

Yes; the instrumented code is different to uninstrumented code. And this means you have to be slightly careful with the results - but most profilers do a reasonable job of drawing your focus to the important bits. I've never had much luck with the sampling option - instrumentation has often been useful, though. Personally, I like the jetBrains offering.

心作怪 2024-07-21 09:20:33

采样模式是当您了解代码中的热点区域时,它不会修改您的代码,它只会对所有正在运行的线程的当前调用堆栈进行采样。 如果您的线程正在休眠或等待资源(互斥体、事件等),那么它将被视为热点区域。 您想使用此模式来测量负载。
仪器模式(跟踪)将测量每种方法花费的时间(以周期为单位)。
它需要检测您的代码(使用调试符号),但最终会排除它给系统带来的开销。 您想使用此模式来测量单个进程。

Sampling mode is when you what to know hot areas in your code, it doesn't modify your code it will just sample the current callstack of of all running threads. If your threads are contently sleeping or wait for a resource (mutex, event, etc) then it will count as a hot area. You want to use this mode to measure load.
Instrumnation mode (tracing) will measure how much time (in cycles) are spend in each method.
It needs to instrument your code (using the debug symbols) but it will exclude at the end the overhead that it put on the system. You want to use this mode to measure an single process.

断桥再见 2024-07-21 09:20:33

是的,在检测时,分析器将使用附加指令来修改您的代码,以收集和跟踪必要的性能数据。 您永远不会想要分发程序集的检测版本,并​​且您不会希望使用检测程序集进行调试(因为关键部分/竞争条件/等在给定附加检测的情况下肯定会表现不同)。

话虽这么说,仪器对于分析要解决的目标非常有价值。 通过收集实际数据并隔离昂贵的操作,可以适当地集中优化工作并准确测量结果 - 避免浪费时间、增加复杂性、降低可维护性以及与过早优化相关的所有其他问题。

Yes, when instrumenting, the profiler is going to modify your code with additional instructions to gather and track the necessary performance data. You'd never want to distribute an instrumented version of your assemblies, and you wouldn't want to use instrumented assemblies for debugging purposes (as critical sections / race conditions / etc could certainly behave differently given the additional instrumentation).

That being said, instrumentation can be very valuable for the goals profiling is meant to address. By gathering actual data and isolating expensive operations, optimization efforts can be focused appropriately and the results can be measured accurately - avoiding wasted time, increased complexity, reduced maintanability, and all the other problems associated with premature optimization.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文