Recipe 18.2. Tracking System Performance with the Performance Console


Problem

You want to track the performance of your system, so that you can see whether there are any problems or bottlenecks.

Solution

The Performance Console is an excellent way to track and graph the activities of Windows XP and its components. To use it, you first set up a log, then have the console monitor your PC, and finally examine the logs.

Setting up your logs

  1. To run the Performance Console, choose Start Run and type perfmon. The Performance Console appears as shown in Figure 18-3; you'll see the Microsoft Management Console (MMC), with the title bar Performance.

    Figure 18-3. The Performance Console, tracking your system's performance


  2. In the left-hand pane, click System Monitor to see a graph of your current system performance, including your processor, memory, and disk. You can use the toolbar buttons to configure the graph data and format. This graph is useful for seeing what's going on now, but useless for looking at the long-term picture.

  3. To create log files of your system's performance, click Performance Logs and Alerts in the left pane of the MMC. You can create counter logs (with the values of performance indicators, measured on a regular basis), trace logs (with the values of performance indicators when something happens, like a program crash), and alerts (an action for Windows to take when a counter hits a specified value). Log files stored in text format contain one line per observation, with values separated by either commas or tabs, and are usually stored in the C:\Perflogs folder. You can import these log files into a spreadsheet or database for analysis, reporting, and graphing. SQL and binary (nontext) log file formats are also available.

  4. Create a counter log by right-clicking Counter Logs in the left-hand pane and choosing New Log Settings from the shortcut menu. Type in the name you want to give the log and click OK.

  5. A log dialog box appears. Specify what statistics you want to log by clicking Add Counters on the General tab of the Properties sheet for the log, as shown in the nearby figure. To select a counter, first select the performance object (that is, the part of the computer system you want to monitor, such as memory or disks), from the Performance object drop-down list and then choose Counters from the list.

  6. For each counter you want to track, highlight it, click Add, and then click Close. A nice feature of this utility is that you can choose whether to monitor the local computer or another computer on your LAN. Don't add more than a few counters, or your log file will grow quickly and be confusing to analyze.

  7. After you choose each counter, you'll be sent back to the log dialog box. Now it's time to set the interval for the frequency you'd like to sample the data. Don't choose too frequent an interval or your log file will take over your entire hard disk (start with once a minute). To do it, click the Log Files tab (Figure 18-4). From the Log file type drop-down list, choose the format of the log (binary, comma delimited text file, and so on if you plan to import this file into a spreadsheet or database program, choose Text File [comma-delimited] for the type). Then in the Example box, type in the name and location for your log.

    Figure 18-4. Creating a new log file


  8. Click the Schedule tab. Specify when the log start and stops manually, or automatically on a schedule.

  9. When you're done, click OK. If you haven't previously created a log file with the name and location you've just given it, you'll be asked whether to create it now. Click OK. The Performance Console will now monitor what you've asked it to, and write the information to a log file.

The Performance console itself can slow down your computer considerably. Run it only when you need it, and don't set the logging interval to be too short. Set logs to stop after a day or two otherwise, they run until your hard disk fills up.


You can also use the command-line tool logman.exe for creating and managing logs, although it offers fewer features than the Performance Console. Typing Logman create will create a new log; Logman start will begin logging; and Logman stop will stop logging.

Discussion

Recipe 18.1 showed you how to monitor your system performance with the Task Manager. So why bother to use the Performance Console?

The primary difference between the two is that the Task Manager provides only a quick snapshot, while the Performance Console lets you create log files that can track performance over a longer period of time, and that you can examine. Additionally, the Performance Console lets you monitor a wider variety of metrics than does the Task Manager. And the Performance Console can set alerts as well as monitor remote systems, neither of which the Task Manager can do.

What to watch for in your logs

There are a lot of counters from which you can choose, but the following may be the most useful because they'll give you important information about system performance:


\Memory\Pages/sec

Number of pages read from disk or written to disk when Windows runs out of memory. Swapping information to and from the disk can slow down your system a lot. Consider adding more memory if you see frequent swapping.


PhysicalDisk\Avg. Disk Queue Length

How many read and write requests are waiting for the disk to respond. High numbers indicate that a faster disk drive would speed up performance.


PhysicalDisk\% Disk Time

What percentage of the time the disk was busy. This is another indicator of a slow or overloaded disk.


Processor\% Processor Time

What percentage of the time the processor was busy with all types of processes. This counter can tell you whether delays are caused by an overloaded CPU.

Viewing performance logs

There are several ways to view your performance logs. You can use the Performance Console itself to view them as graphs, or you can examine them using another tool, such as a spreadsheet. To view a log as a graph:

  1. Click System Monitor in the left pane of the Performance Console window and click the View Log Data icon on its toolbar. (The icon is the fourth from the left.)

  2. The System Monitor Properties dialog box appears. Click the Source tab and select Log files.

  3. Click the Add button. Browse to the folder that contains your log, and double-click the log file. Click OK.

  4. You'll see a graph of the log file. If you want to change the way the log looks, click the Properties button on the toolbar. You'll be able to customize the log's appearance.

To look at the contents of a comma-separated (.cvs) log file in Excel or your default spreadsheet program, double-click the filename in Windows Explorer. Excel may complain that the file is still open (since the Performance Console is still appending information to it); click Notify to see what's in the file so far. In Excel, you can analyze, graph, and print the counters.

Performance alerts

The Performance Console can alert you when there's a performance problem with your PC. To set this up, you create an alert that lets you know when a counter exceeds a specified value. For example, the Performance Console can let you know when the idle processor time drops below 10%:

  1. Right-click Alerts in the left pane of the Performance Console window and choose New Alert Settings.

  2. Type in the name you want to give to the alert, and click OK.

  3. The Alert dialog box appears. Add one or more counters that you want to track, by clicking Add, selecting the counter for which you want to set an alert, and then clicking OK. When you've added all of the counters you want to track, click Close.

  4. You'll be sent back to the Alert dialog box. On the General tab, specify the limit (upper or lower) beyond which Windows should take action.

  5. Click the Action tab. Specify what Windows does when the alert occurs. You can have it add a note to an event log, run a program, send a network message, or start a new log.

  6. When you're done, click OK. The alert will monitor your system and perform the action you requested when it reaches the limit you've set.

See Also

You can also use command-line tools to manage some aspects of your logs. For details, see MS KB 303133.

To learn how to log data directly into an SQL database, see MS KB 296222.



Windows XP Cookbook
Windows XP Cookbook (Cookbooks)
ISBN: 0596007256
EAN: 2147483647
Year: 2006
Pages: 408

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net