我正在尝试使用 xperf 分析 ASP.NET 应用程序(本地运行)中的 CPU 时间。
到目前为止,我遵循了标准程序:
- 以管理员身份运行
cmd
xperf -on 基础
- 在网络应用中执行一些操作。
xperf -d mylog.etl
xperfview mylog.etl
- 跟踪 -> 加载符号
- 汇总表
此时,我可以看到非托管代码的调用报告。
我需要做什么才能在我的 .NET 程序集中看到相同的结果?这可能吗?
我的 PDB 路径位于 _NT_SYMBOL_PATH
中,至少我知道 MS 符号已加载。
我见过this question ,但没有分辨率。根据this answer ,
You need the xperf Version from the Windows 8 SDK. This version supports .net. Start a trace with the new Performance Recorder UI and this tool generates PDBs for ngened .net components so that xperfview and WPA can decode the callstack.
谁能证实这一点?我正在使用 Windows 7 和 Windows 7 SDK。我对安装另一个平台 SDK 持怀疑态度。
更新:是的,Windows 8 SDK 在 Windows 7 上运行,为此,您唯一需要的是性能工具包。事实上,您甚至不必使用新的“Windows 性能分析器”,因为新的“Windows 性能记录器”生成的 etl
文件仍然可以与 xperfview
一起使用>,包括增强的堆栈跟踪。请参阅对已接受答案的评论以获取更多说明。
最佳答案
是的,您需要 Windows 8 版本。尝试一下,您会发现效果很好。如果您想使用 xperf 而不是 WPR(UI),请按照以下步骤操作:
http://msdn.microsoft.com/en-us/library/ff357718%28v=vs.100%29.aspx
关于asp.net - 我可以使用 xperf 来分析托管代码吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18746810/