Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
I know it is has been a while since my last posting, but long ago I decided that I would not write just to have something to write about but rather only when I had something I really something useful to say.
Well do have something really useful to say. For a long time I have wanted to give very specific advice about how to do various performance investigations, however, it was hard to do so as the only public tools Microsoft had for CPU investigation we had were Visual Studio's profiler (which until recently was available on for relatively expensive versions of Visual Studio), or XPERF (which did not have support for decoding symbolic information for managed code). For memory investigations we had CLRProfiler tool, however that tool had scaling problems (it really could not handle GB sized heaps which have become common), and I always found the node-arc visualization of the data to hard to use effectively.
Well, that all has changed. After months of work to get it published, I am happy to announce that a VERY useful performance tool called PerfView is now available at the Microsoft downloads center. You can download this tool for free at the PerfView Download site right now. I do alot of performance investigation on a daily basis, and this is the single most useful tool I have to do my job, do recommend you give it a spin.
To get started
To give it a spin, simply click on the 'Tutorial' link on the main page (either at the top or in the 3rd paragraph in the body), and minutes later you are doing your first PerfView performance analysis.
Notable features of PerfView:
Now that the PerfView tool is public, you can expect to hear a lot more from me from my blog, as I expound more on performance best practices (now that there is no excuse for getting some data!).
So what you are waiting for? You should be downloading PerfView....
Vance
P.S: The goal of this (and subsequent) articles is to get people doing sucessful performance analsysis. You can use PerfView for this, but there are other good tools as well. In particular, the WPR.exe tool (the new tool by the XPERF team), released as part of the windows 8 //build conference, also handles symbolic information associated with managed code (e.g. you get stack traces with method names). You are also more then welcome to use this tool to do managed code analysis (and as mentioned, the data from WPR and PerfView is interchangable). See the Windows Performance Analsysis Center for more on that tool.
Anonymous
December 28, 2011
Tried to analyze dump with no luck.
Error taking heap dump: System.ArgumentNullException: Value cannot be null.
Parameter name: dacFilename
at RealtimeMemDiag.DumpDataTarget.Create(String dacFilename)
at GCHeapDumper.DumpHeapFromProcessDump(String processDumpFile, String outputFileName)
at Program.Main(String[] args)
Symbols are correct and set in environment
Anonymous
December 28, 2011
The comment has been removed
Anonymous
December 28, 2011
Link you left for XPERF/WPR in section 3 of notes seems to be wrong
Anonymous
December 29, 2011
The link listed under number 1. above is broken (but the one just above it labeled PerfView Download Site works).
Anonymous
December 29, 2011
Trying to set the symbol path from the menu locks up the UI because the PerfView.StackViewer.StackWindow.UserOKWithSymbolServer does not work when called on the UI thread (it calls Dispatcher.BeginInvoke and then waits for the result with Thread.Sleep...).
Anonymous
December 29, 2011
The comment has been removed
Anonymous
December 31, 2011
I have fixed the links people complained about. Please let me know if they break again.
tobi's problem with collecting data is actually compaining that there is already a ETW session running (you can only have a single Kernel ETW session running. The most common issue is that previous session was left running (although there is logic that is supposed to deal with this). Anyway, the work-around is to insure that all sessions are stopped by using the Collect -> Abort function and then try again.
Pent's issue setting the symbol path is indeed because of some unfortunate code put in late in response to privacy concerns (basically asking you if you want to contact Microsoft symbol servers). It will be fixed, however, the simple work-around is to not set the symbol server path in the gui until AFTER you have done a 'Lookup Symbols' operation (which will force the prompt of whether you want to use the Microsoft symbol server).
Anonymous
December 31, 2011
The workaround works for my problem. Thanks.
Anonymous
January 01, 2012
I have tried only the GC Snapshot part. It can take GC dumps and diff them that is very good. But when I look what other commercial profilers do offer it is still light years behind. The most needed feature is to look into specific object instances to see the actual values of its members. I want to know how many objects this big list has and what the first 3 values are and I want to drill down further....
This is a must have feature for any memory profiler. The Visual Studio Profiler is so slow that I could download YourKit Profiler, install it, activate it, start the process again with the profiler, take two memory snapshots and diff them while Visual Studio is still analyzing my small NUnit process....
This brings me to the second point. The Memory profiler is quite slow when taking a dump and much slower when loading and diffing it. Commercial tools are much faster. This is not so much of an issue for small GC heap s (30MB) but if you have a real app gone wrong with hundreds of MB it will take forever to load.
Anonymous
January 02, 2012
I noticed I overlooked 'SloNN' issue. When dumps are examined on machines that don't have the same version of the runtime as the machine where the dump was collected, you go down code paths that are relatively hard to test (you have to set up machines with different CLR versions). From the stack trace I was able to make a fix, however testing it properly will take longer.
In the mean time, the work-around is insure that the same version of the runtime is on the machine that extracts the GCHeap as the one where the process dump was taken. An easy way to do this is to simply do the extraction on the machine where the dump was taken.
Anonymous
January 04, 2012
Excellent tool, Vance. I'm able to analyze performance for my target application, however, PerfView is also collecting data from every other process running on my computer (even when I specify the target with Collect->Run). Is there a workaround for this? Thanks.
-Robert.
Anonymous
January 30, 2012
Is there a list of what all I need to have ngen'd when analyzing a 64 bit process on Windows 7?
I ngen'd all my binaires for my process, but when I capture dumps I still get the stack broken error.
The ngen command I ran is:
for /r %i in (*.dll) do ngen install %i
Do I need to ngen all the system binaries as well? (System.core, etc....)
Anonymous
January 31, 2012
On windows 7, all DLLs that ship with the .NET Framework should already be NGENed. Thus you should not have to worry about those. It is your own code (your ASP.NET page, or your application), that is typically the issue.
Also note that there are other reasons for broken stacks other than not having NGENed images.
You can tell it is the NGEN issue because the first child of the 'BROKEN stack is a managed DLL and does not end in .ni.dll.
Please see the docs for more information. (search for 'BROKEN'). Finally as mentioned int the docs, even if you have broken stacks, you typically can do alot of useful analysis.
Anonymous
October 25, 2012
I have a situation similar to the one in your GC mem leak video: in my WPF app, I do an operation and close an item (call it TaskClipboard for clarity, that's the class name). I find that everytime I do that, the instance of TaskClipboard is not in fact destroyed: after N times doing this, N-1 instances of TaskClipboard exist that are not in visual tree, and have IsLoaded and IsVisible false. One instance has IsLoaded and IsVisible.
Now a diff of GC heap with PerfView shows TaskClipboard with Inc % at 50%. When sorting on Inc%, objects below it are much less, like 2%, and those above are either app/MainWindow or some things contained in the TaskClipboard instances, so surely this is a good sign. But if I double-click the TaskClipboard row, there are only two children that show up: one is a FrameworkElement that is in the TaskClipboard, but it has very low Inc% (0.3%) so I'm thinking it is not the culprit; the other is a [Strong Handle] with almost the same metrics as the TaskClipboard row, so I'm thinking that's what is holding the extra instances alive.
So the question is of course: how do I find out what is that [Strong Handle]?
Anonymous
November 17, 2012
The comment has been removed
Anonymous
November 25, 2014
I am trying to get hands on with PerfView I tried doing the "Tutorial.exe" but the CPU stack did not show me anything after the PerfView completed its processing. More ever in the Process Summary page in PerfView it shows me "Tutorial Process did nto live for the entire trace.
In the log I see the ERROR: could not find any CPU in focus processes, using machine wide total.
Helps appreciated to resolve this.
Anonymous
November 25, 2014
Hmm, this is very surprising. If you copy your ETL.ZIP file that got generated to http://1drv.ms/1xoq5bU and send mail to vancem@microsoft.com I can take a look. You may also wish to try other programs besides the built in tutorial just to see if it is specific to that app.
Anonymous
September 28, 2015
The comment has been removed
Anonymous
September 28, 2015
Sounds like your machine is running with a special security configuration. Is that possible? Does PerfView work on more other machines where there is no group policy or other things that might have tightened security?
Anonymous
September 28, 2015
I would imagine my company has done a special security configuration on these VM resources. The primary reason to try this VM is to get Admin access, something that has be removed from our local workstations, but available in the VM offering. I was hoping to be able to circumvent the hardening, but I'm not clear on which privilege it is trying to access at the point of exception.
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in