December 28th, 2017

How does Resource Monitor get information for processes that already terminated?

How does the Resource Monitor program get information for processes that have already terminated?

Try it: Run Task Manager, then go to the Performance tab. From there, click Open Resource Monitor. Now run another program, say, Notepad. Let Notepad run for a while, and then close it. Observe that there is still an entry for notepad.exe in Resource Monitor, labeled Terminated.

What is the function to call to get performance statistics on a program that has terminated?

There is no function to get performance statistics for a program that has terminated. What you’re seeing is an optical illusion: Resource Monitor continues to show statistics for processes that have terminated, so that you can see the final results before they go away.

Here’s proof that it’s an illusion: After exiting Notepad and putting it into the grayed-out Terminated state in Resource Monitor, go back to Task Manager and click Open Resource Monitor again. This will open another instance of Resource Monitor, and in that new instance, you’ll see no trace of the terminated Notepad process.

Now you see it. Now you don’t.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.