Analyzing Processor Activity

You can determine the percentage of time that threads of a process are running in user and privileged mode. User mode is the processing mode in which applications run. Privileged or kernel mode is the processing mode that allows code to have direct access to all hardware and memory in the system. Developers might want to know how much time a process is spending in each mode and what function is using the processor in this way.

I/O operations and other system services run in privileged (kernel) mode; user applications run in user mode. Unless they are graphics-intensive or I/O-intensive (such as file and print services), most applications should not be processing much work in kernel mode.

System Monitor has % Privileged Time and % User Time counters on the System, Processor, Process, and Thread objects. These counters are described in Processor Counters earlier in this chapter. System Calls/sec is also a useful indicator of privileged time usage because application calls to the operating system are handled in privileged mode.

In the user time and privileged time counters, System Monitor displays the percentages of total processor time that the process is spending in user or privileged mode.

Figure 29.13 is a System Monitor report on the amount of user and privileged time for three processes.

Cc958308.fned89(en-us,TechNet.10).gif

Figure 29.13 User and Privileged Time for Processes

In Figure 29.13, Microsoft Management Console (MMC), the process in which System Monitor is running, is running mainly in privileged mode. Taskmgr.exe, the Task Manager process, is also running mainly in privileged mode , though this proportion varies significantly as the process runs. In contrast, Cpustres, the process for the CpuStress test program, runs entirely in user mode all of the time.

Figure 29.14 shows the amount of user and privileged time for each thread of the Task Manager process.

Cc958308.fned88(en-us,TechNet.10).gif

Figure 29.14 User and Privileged Time for a Process and Its Threads

The Process Viewer (Pviewer.exe) utility displays the amount of user time and privileged time for each running process and for each thread in the process. In Process Viewer, the user and privileged mode percentages for each process always total 100 percent because idle time is included. However, in System Monitor the percentages for each process reflect the amount of nonidle processor time actually used in each mode and instead total the amount of nonidle time. Therefore, the value for each process might not total 100 percent. To see the process times add up to 100 percent, combine the percentages for all processes including the Idle process.

For information about Pviewer.exe, see Windows 2000 Support Tools Help. For information about installing and using the Windows 2000 Support Tools and Support Tools Help, see the file Sreadme.doc in the Support\Tools folder of the Windows 2000 operating system CD.