Can I use xperf to profile managed code?

2.1k views Asked by At

I am trying to profile the CPU time in an ASP.NET application (running locally) using xperf.

So far, I've followed the standard procedure:

  1. Run cmd as administrator
  2. xperf -on base
  3. Do some stuff in web app.
  4. xperf -d mylog.etl
  5. xperfview mylog.etl
  6. Trace -> Load symbols
  7. Summary table

At that point, I can see the call reports for the unmanaged code.

What do I have to do to see the same for my .NET assembly? Is this even possible?

I have the path to my PDB in _NT_SYMBOL_PATH, and at least I know that the MS symbols are loaded.

I've seen this question, but it has no resolution. According to 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.

Can anyone confirm this? I am using Windows 7 and the Windows 7 SDK. I'm skeptical about installing another platform SDK.

UPDATE: Yes, the windows 8 SDK runs on Windows 7, and for this purpose, the only thing you need is the Performance Toolkit. In fact, you don't even have to use the new "Windows Performance Analyzer", because the etl files generated by the new "Windows Performance Recorder" will still work with xperfview, including the enhanced stack traces. See comments to accepted answer for further notes.

1

There are 1 answers

2
magicandre1981 On BEST ANSWER

yes, you need the Windows 8 version. Try it out and you see that it works fine. If you want to use xperf instead of WPR(UI), follow this:

http://msdn.microsoft.com/en-us/library/ff357718%28v=vs.100%29.aspx