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.