Analyzing Processor Activity

Bottlenecks can result from activity of multiple threads in a single process, single threads in multiple processes, or multiple threads in multiple processes. Because these problems require different solutions, you need to first distinguish their causes.

To study threads during a bottleneck, log counters of the Processor, Process, and Thread objects for several days at an update interval of 60 seconds. This allows you to look at thread activity during typical operating conditions and helps you associate that activity with processor usage.

important-icon

Important

Performance counter values for threads are subject to error when threads are stopping and starting. Faulty values sometimes appear as large spikes in the data. For more information, see Overview of Performance Monitoring in this book.

To determine whether a process is single threaded or multithreaded

  1. Right-click the Windows task bar and then click Task Manager .

  2. In Task Manager , click the Processes tab, and from the View menu, click Select Columns .

  3. In the Select Columns check box, select Thread Count , and then click OK .
    This column shows the total number of threads associated with the process.

Figure 29.10 illustrates how Task Manager displays the number of threads running in a process and the name of the process.

Cc958320.fned12(en-us,TechNet.10).gif

Figure 29.10 Number of Threads Initiated by a Process Shown in Task Manager

In System Monitor or in Counter Logs, select the Thread object and look at all instances listed in the Instance box. If there are several thread identifiers (IDs) listed, then the process is multithreaded. Figure 29.11 illustrates multiple threads of a process as they are listed in the Instances box in the System Monitor user interface.

Cc958320.fned13(en-us,TechNet.10).gif

Figure 29.11 Thread Instances Shown When Adding Counters in System Monitor

System Monitor identifies threads by process name and thread number. The order in which the threads appear on the chart depends on the order in which you add them to your chart. The thread number shown in the Instance box represents the order in which the threads started, and it can change even as the process runs.

Thread identifiers are valid only during the lifetime of the thread; they are recycled when the thread terminates. Thread numbers can change while running, so it is best to monitor by thread identifier. The Task List Viewer (Tlist.exe) utility provides thread identifier information. For information about Tlist.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.

If a process is multithreaded, adding a processor improves performance. If it is single threaded, you can improve performance by using a faster processor. These solutions are more advanced and more relevant to developers who also might want to tune the problem applications.