52ky 发表于 2021-6-11 12:42:59

Writing a profiler for Silverlight applications

Writing a profiler for Silverlight applications,在我的公司,我们有一个非常复杂的 Silverlight 应用程序。此应用程序高度动态且完全异步。最近我们在较慢的 PC 上遇到了一些性能问题。不幸的是,目前还没有任何适用于 Silverlight 应用程序的合适的分析器。因为 - 正如我已经提到的 - 我们的应用程序相当复杂,如果没有一个好的分析工具,很难甚至不可能彻底分析这个应用程序。我们尝试了各种方法来追踪问题,例如手动添加跟踪代码或为我们在 IoC 容器中注册的所有类编写分析拦截器。通过这种方法,我们能够跟踪一些热点,但这些只是冰山一角。在与一位同事讨论时,他向我展示了他在 Mono Cecil 库的帮助下正在做什么,我突然意识到:“我可以编写自己的分析器!”。
这是我使用 Mono Cecil 库的第一个项目。在这个项目中,我们只需要 Mono.Cecil.dll 程序集。
请注意,此处介绍的技术可用于任何类型的程序集,而不仅限于 Silverlight 程序集。


(In my company we have a very complex Silverlight application. This application is highly dynamic and fully asynchronous. Lately we encountered some performance problems on slower PCs. Unfortunately there doesn’t yet exist any decent profiler for Silverlight applications. Since - as I already mentioned - our application is rather complex it is difficult to impossible to analyze this application thoroughly without a good profiling tool. We have tried various ways to track down the problems by e.g. manually adding trace code or by writing profiling interceptors for all our classes that are registered in the IoC container. With this methods we were able to track some hotspots but these were only the tips of an iceberg.
While discussing with a coworker who showed me what he is doing with the aid of the Mono Cecil library I suddenly realized: “I can write my own profiler!”.
This is my first project using the Mono Cecil library. In this project we only need the Mono.Cecil.dll assembly.
Please note that the techniques presented here can be used for any type of assembly and are not restricted to Silverlight assemblies.)


页: [1]
查看完整版本: Writing a profiler for Silverlight applications