Hack108.Track System Performance with the Performance Console


Hack 108. Track System Performance with the Performance Console

Before you can hack away at things to speed up your computer, you should know how to monitor system performance in the first place. As a power user, you'll like knowing what's causing those slowdowns and blips in performance. The Performance Console is a great hacker's tool for monitoring and tracking resources of all kinds.

Computers get faster every year, but somehow we sometimes still end up waiting around for them to finish a task.

Reducing Visual Effects

Windows XP's visual effectssuch as fading and sliding menus, background images for folders, and drop shadows for icon labelsmake it the snazziest-looking operating system Microsoft has produced so far. But all those effects can take their toll on system performance, especially if you have an older computer.

XP gives you the option of balancing these visual effects against system performance. You can go full-bore and use all the visual effects, you can turn all of them off, you can have your system decide which to use, or you can pick and choose which effects to turn on and off. Right-click My Computer and choose Properties Advanced Settings (under the Performance section). To turn off all visual effects, choose "Adjust for best performance." To use all visual effects, choose "Adjust for best appearance." To turn individual effects on and off, choose Custom, then check the effects you want to use and uncheck the ones you don't. Experiment to see how they affect system performance.


To figure out what's slowing down your computer and to get to the root of the problem, use the Performance Console (perfmon) to track and graph the activities of Windows XP and its components. First, I'll show you how to set up a log, and then I'll give you some ways to put the console logs to good use.

12.2.1. Setting Up Your Logs

Choose Start Run and type perfmon. You'll see the Microsoft Management Console (MMC) with the Performance titlebar. In the left 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 it's useless for looking at the long-term picture.

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, such as 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. (See article Q296222 in the Microsoft Knowledgebase for how to log data directly to an SQL database.)

Create a counter log by right-clicking Counter Logs in the left pane and choosing New Log Settings from the shortcut menu. Give the new log a name and press OK. Specify the statistics you want to log by clicking Add Counters on the General tab of the Properties sheet for the log (see Figure 12-1). 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. 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), and then choose counters from the list.

Figure 12-1. Creating or editing a performance log


Set the interval to the frequency at which 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). On the Log Files tab, specify the file type, name, and location. If you plan to import this file into a spreadsheet or database program, choose Text File (comma-delimited) for the type. On the Schedule tab, specify when the log start and stopsmanually, or automatically on a schedule.

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'll run until your hard disk fills up.


12.2.2. What to Watch

These counters are often worth logging:


\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 significantly. Consider adding more memory.


\PhysicalDisk\Avg. Disk Queue Length

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


\PhysicalDisk\% Disk Time

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


\Processor\% Processor Time

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.

12.2.3. Viewing Performance Logs

With the System Monitor in the MMC, you can view a log as a graph. Click System Monitor in the left pane of the MMC window and click the View Log Data icon on its toolbar. Add the log file to the list. When you are looking at the graph, click the Properties button on the toolbar to change how the graph looks.

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 might 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.

12.2.4. Performance Alerts

Create an alert to let you know when a counter exceeds a specified value. For example, the Performance Console can let you know when the idle processor time drops lower than 10%. Right-click Alerts in the left pane of the MMC window and choose New Alert Settings to create a new alert. Add one or more counters, and specify the limit (upper or lower) beyond which Windows should take action. On the Action tab, specify what Windows does when the alert occurs: specifically, you can have it add a note to an event log or run a program.

Margaret Levine Young



    Windows XP Hacks
    Windows XP Hacks, Second Edition
    ISBN: 0596009186
    EAN: 2147483647
    Year: 2003
    Pages: 191

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