Differentiating process instances in Perfmon
If you’re running in a terminal services environment, or have multiple instances of a given application running on your machine, this tip will help you to work out which process is which in Perfmon. To see the issue, I’ve created a simple Windows Forms application and run up three instances of it on my machine. When I go into Perfmon, which process is which?…
You’ll see here that I have 3 instances of my test application - TestWinFormsApp, TestWinFormsApp#1 and also TestWinFormsApp#2. So, if I want to capture counters for a specific one of these (and maybe do some other stuff like taking process dumps at the same time) how can I do that as I don’t know the process ID?
Well, you can use Perfmon to display the process ID for you. Scroll down to the ‘Process’ section, choose ‘ID Process’ and then select your process instances and click on Add.
You’ll then have the process ID captured for you by Perfmon – it’s shown as all of the figures on the graph, so in the following my process ID is 5896…
Armed with the knowledge of the process ID, you can now capture Perfmon stats for a given instance (say TestWinFormsApp#1 in the above), and also use adplus –hang –p 5896 to get a memory dump of the same process at the same time. I needed this information to help a customer take some memory dumps and perfmon stats for me, so thought it might come in useful for someone else.
If you don’t know what adplus is, skip over to the Debugging Tools for Windows site, download and enjoy.