Look at ProcDump Tool For Memory Dump Collection

Look at ProcDump Tool for Memory Dump Collection

 
In this article, we will look into ProcDump, its purpose, and how to use it. We can use this tool for collecting a memory dump of an application based on CPU usage. We can download the tool from here. Let's install it and explore the functionality. ProcDump is a command-line utility, that is helpful in collecting a full/mini memory dump based on its CPU usage or unhandled exceptions. This tool is handy in troubleshooting High CPU issues on an application, it can be ASP.NET (w3wp.exe) or Win Forms, or WPF. Occasionally, our applications might spike the CPU. In this kind of scenario, it's hard to collect a memory dump exactly at the time of the spike. Using this tool, we can configure rules to collect a dump when it reaches certain CPU usage. Let's open ProcDump in a command prompt by going to its installation path:
 
ProcDump-Tool-1.jpg
 
We will now explore options available for collecting a dump.
 
Command: Procdump processname/processId
 
Purpose: it collects a minidump (small in size) having only thread/handle information; the stack trace is based on the process name.
 
ProcDump-Tool-2.jpg
 
Command: Procdump -ma processname/processId
 
Purpose: it collects a full user dump based on the process name/id.
 
ProcDump-Tool-3.jpg
 
Command: procdump w3wp.exe -c 20 -ma
 
Purpose: it collects a full user dump of w3wp.exe when its CPU usage exceeds 20%.
 
ProcDump-Tool-4.jpg
 
Command: procdump w3wp.exe -p "\Processor(_Total)\% Processor Time" 5 -n 2
 
Purpose: it collects two full user dumps of w3wp.exe when the System CPU usage exceeds 5%.
 
ProcDump-Tool-5.jpg
 
Command: procdump -ma -e notepad.exe
 
Purpose: it collects a full user dump of notepad.exe when it throws an unhandled exception.
 
ProcDump-Tool-6.jpg
 
Command: procdump -e 1 -f "" notepad.exe
 
Purpose: it shows the exception codes of notepad.exe without collecting any dump.
 
ProcDump-Tool-7.jpg
 
By using this tool, we can collect a dump based on CPU usage, exceptions, or on a performance counter (using the -p option) value like Processor Time, Handle Count, and so on. Once we have a dump, it can be analyzed using the Debug Diag or WinDbg tools.