Wednesday, January 13, 2010

Monitor cpu utilization of all threads in a process in windows

Hi All,

We can monitor cpu utilization of all threads for a process in windows using perfmon tool and this tool also writes logs to a file.
We can also use process explorer for this but this tool can not write logs.

To monitor threads in a process in windows,
1: Launch perfmon
2:Click Performance Logs and Alerts tree on left most window
3:Select Counter Logs from tree structure
4: Right click Counter Logs and select "New Log setting"
5: Give any name for new logs.
6: Click on Add general tab at top.
7: click "add counters" button.
8:From "Performane objects" drop down, select thread.
9:At right hand side, it will display all currently executing threads in windows.
10:Select the threads, you want to monitor and counter to monitor from lft hand side window.
11:Click close and go to "Log Files" tab.
12:Set the log file path and type.