Xperf Analysis Basics(转)
2014-01-14 18:24 Clingingboy 阅读(555) 评论(0) 编辑 收藏 举报
FQ不易,转载
http://randomascii.wordpress.com/2011/08/23/xperf-analysis-basics/
I started writing a description of how to examine CPU Sampling data in xperf and realized that I needed a basics article to link back to. Here it is. Learn this before you go further.
Symbols
Without symbols you can’t do much, so configuring your symbol path is important. I use a variation on this batch file prior to running xperfview. Configure the “localbuilds” and “OurSymbolServer” directories appropriately, but leave the Microsoft symbol server as is.
@rem Add local build directories
set SYMS=c:\build\localbuilds
@rem Put symbol servers at the end to avoid network trips looking for local symbols.
set SYMS=%SYMS%;SRV*c:\symbols*\\OurSymbolServer\symbols
@rem Microsoft’s symbol server.
set SYMS=%SYMS%;SRV*c:\symbols*http://msdl.microsoft.com/download/symbols
set _NT_SYMBOL_PATH=%SYMS%
If this dialog keeps popping up when you load symbols in xperfview:
then it means you’ve hit a UAC (User Account Control – admin/non-admin) bug. Follow the link to solve it.
You can also configure symbols by going to Trace->Configure Symbol Paths.
You load symbols by going to Trace->Load Symbols, or right clicking and selecting Load Symbols.
It’s worth mentioning that symbols are compressed and cached to c:\symcache. This is an efficient symbol cache that is used exclusively by xperfview. Set the _NT_SYMCACHE_PATH variable if you want to configure the location. I just leave it at its default.
Zoomin’ In, Zoomin’ Out
Navigating the main window in xperfview is mostly a matter of zooming in and out. The obvious ways of doing this are in the right-click context menu. This menu lets you zoom in to the current selection, or zoom all the way out (Unzoom). I find this set of options frustrating. I like to zoom in and out a little bit. Zoom to selection is okay, I guess, but to have the only zoom-out option be “all the way out” is a bit silly.
The solution is to make sure you have a mouse with a mouse wheel. Hold down the control key and roll the wheel. That’s the way real programmers do it. I can’t use xperfview without a mouse wheel.
Enabling/Disabling/Reordering the Graphs
Xperfview defaults to having a particular set of graphs visible. The choice of graphs is biased towards people who are working on optimizing Windows itself, and is not as good a choice for those of us who are not actively working on the Windows scheduler. With that in mind, I recommend that you click on the flyout on the left side of the xperfview window and enable and disable graphs until it matches the correct set of graphs, conveniently shown here:
If you want CPU sampling by CPU, then go for it, but I think you’ll find it is usually not worth it.
In addition, you can change the order of graphs in order to get all of your favorites together. Just drag them around in this list to reorder them, and then double-click on the one you want to see.
Xperfview will remember the enabled/disabled state. That is good.
Xperfview will not remember the order of the graphs. You can’t win them all.
Selections
Selecting a region of interest in a trace is important because that lets you select which part of the trace you will invoke a summary table for. The diamonds on the CPU Scheduling graph and some other graphs are useful because they mark key points and because when selecting you can snap to them.
Once you’ve got a selection you can replicate it to other graphs by right clicking and selecting Clone Selection. This is often very useful.
That’s all folks
That’s enough for now. I’ll add more basics later if they seem worth it.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 周边上新:园子的第一款马克杯温暖上架
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
· 使用C#创建一个MCP客户端