Leadership

Analyze Windows XP memory usage with a customized version of Performance Monitor

Greg Shultz shows how to create a customized Windows XP Performance Monitor console to track memory usage and interpret the results.

Are you supporting Microsoft Windows XP users who complain about slow performance? If so, chances are you're thinking that you might solve the problem simply by adding more RAM to the system. But will that really solve the problem?

Of course, it's a no brainer that adding more RAM will improve performance at some level, and with the current prices, doing so is a relatively inexpensive upgrade. However, you may be wondering whether you'll really gain a big enough performance boost to justify the cost.

This blog post is also available in PDF format in a TechRepublic download. This article was originally published on August 9, 2004.

For example, suppose that the Windows XP system of the user who is complaining about performance has 256MB of RAM. Under normal operating circumstances, 256MB is actually a pretty good amount of RAM for a typical XP workstation. But is it really enough for the type of work this particular user is doing with his computer? Would jacking up the RAM to 512MB really help?

Fortunately, you can find out by configuring Windows XP's Performance Monitor to track memory usage over the course of a typical workday. You can then study the results and determine whether a memory upgrade will really improve performance. Here's how to create a customized Windows XP Performance Monitor console to track memory usage and how to interpret the results.

Creating the Memory Tracker console

While you can use Performance Monitor right out of the box, so to speak, I've discovered that creating a customized version via the Microsoft Management Console (MMC) provides a more focused approach to any monitoring operation. Plus, creating a customized console for a specific task has other benefits. To begin with, you can quickly and easily use the monitoring tool at any time. And best of all, you can copy the customized console to a CD and use it on other systems.

Fortunately, creating a customized console is easy. To begin, access the Run dialog box from the Start menu and type mmc in the Open text box. When you see the empty console, pull down the File menu, select the Save command, name the console Memory Tracker.msc, and then click the Save button. Then, right-click on the Console Root folder, select Rename, and name the folder Memory Tracker.

Now, pull down the File menu and select the Add/Remove Snap-in command. When you see the Add/Remove Snap-in dialog box, click the Add button to open the Add Standalone Snap-in dialog box, as shown in Figure A.

Figure A

The Add Standalone Snap-in dialog box lists all the snap-ins that are currently available for use in your custom console.
By default the ActiveX Control snap-in will be selected, and you can immediately click the Add button to launch the Insert ActiveX Control Wizard. When you see the Welcome page, just click Next. When the Control Category and Type page appears, leave the All Categories option selected in the Control Category drop-down list. Scroll through the Control Type list, select System Monitor Control, as shown in Figure B, and click Next. Then, on the Insert ActiveX Control page, type Memory Counters in the text box and click Finish.

Figure B

Once you launch the Insert ActiveX Control Wizard, you'll locate and select the System Monitor Control.

When you return to the Add Standalone Snap-in dialog box, you'll repeat these same steps to launch the Insert ActiveX Control Wizard and access the System Monitor Control one more time. Only this time through, you'll name the control Log Viewer.

When you return to the Add Standalone Snap-in dialog box for the third time, scroll down the list, select the Performance Logs and Alerts snap-in and click Add. Then, close the Add Standalone Snap-in dialog box and click OK to close the Add/Remove Snap-in dialog box. At this point, your custom Memory Tracker console should look like the one shown in Figure C. Before you continue, press [Ctrl]S to save the console.

Figure C

When you complete the procedure, your custom Memory Tracker console will be ready to configure.

Adding the counters

Once you've created your custom Memory Tracker console, you're ready to add the counters that will allow you to track memory usage. To begin, maximize the window, select the Memory Counters icon, and then click the Add button on the Performance Monitor toolbar that appears in the right panel. Alternatively, you can press [Ctrl]-I.

When you see the Add Counters dialog box, you'll use this data to add the necessary counters to the graph:

  • Memory - Pages/sec
  • Memory - AvailableMBytes
  • Server - Pool Nonpaged Failures
  • Server - Pool Paged Failures
  • Server - Pool Nonpaged Peak
  • Paging File - % Usage *
  • PhysicalDisk - % Disk Time *
  • PhysicalDisk - Avg. Disk Sec/Transfer *
  • PhysicalDisk - Current Disk Queue Length *

Select an object from the Performance Object drop-down list and then select the associated counters from the scrolling counters list. As you select each counter, click the Add button. As you do so, you'll see that counter appear in the graph and in the legend below the graph.

I'll discuss these counters in more detail later when I explain how to interpret the results of the monitoring operation. For now, just keep in mind that the reason I selected counters from these particular Performance Object categories is that when combined, they provide an excellent picture of how Windows XP is utilizing its memory potential during a typical computing session. By memory potential, I'm talking about both physical and virtual memory.

To continue, click the Close button to dismiss the Add Counters dialog box. At this point, you're ready to configure the monitoring operation.

Configuring the monitoring operation

As soon as you return to the Memory Tracker, you'll see that it's already charting your memory usage in the graph area. As you'll notice, the timer bar will be running very quickly. That's because, by default, the sampling interval is set at 1 second and the graph is set to use a default time period, called the Duration, of 1 minute 40 seconds. As such, you'll want to change the sampling interval, which will in turn extend the Duration.

To do so, click the Properties button on the toolbar. When you see the System Monitor Properties dialog box, locate the Seconds text box on the General tab and change the value to something more appropriate.

To get a good picture of memory usage, I suggest that you select a sampling interval of 15 seconds. While this may sound like an odd interval, there is a method to my madness, and that is that this interval extends the Duration of the data collection to exactly 25 minutes.

To continue, click the Graph tab and then select the Vertical Grid check box. (While you have the Graph tab open, you should change the Maximum value from 100 to 300.) Then click OK. You'll now see that the graph is divided into twenty-five vertical segments such that each minute is now demarcated by a vertical bar, making it easy to track your memory usage for the time period. At this point, your Memory Tracker will look like the one shown in Figure D.

Figure D

When monitoring the current activity, you'll get a better view of what is happening if you extend the sampling interval and enable the vertical grid.

If you wish to extend the monitoring operation to a longer time period, you can set the time interval to 360 seconds. Doing so will set the Duration to exactly one hour.

Monitoring

You're now ready to start your monitoring operation. To begin, take note of what time it is, keeping in mind that you'll want to complete the monitoring procedure in 25 minutes. Next, click the Clear Display button on the Memory Tracker toolbar to get a clean slate and then minimize the window.

Now, use the computer as you normally would, making sure that you really put the system to work performing all the types of tasks that you do on a normal workday. If you don't, you really won't get an accurate picture of memory usage.

When the 25-minute time period is up, maximize your Memory Tracker window and immediately click the Freeze Display button on the toolbar. That way, the data that you recorded won't scroll off the graph as you're studying it.

Studying the data

While the full 25-minute graph is very interesting to look at and reveals the big picture, it's difficult to make any specific analysis of memory usage based on just looking at the graph itself. Instead, you really need to take a close look at each individual counter. However, it's important that you keep in mind that as you study the data provided by each individual counter, you can't jump to any conclusions based on any one counter. Rather the goal is to aggregate the data provided by each counter in order to obtain the full picture.

To do so, you'll need to select a counter in the legend and then look at the values in the Average, Minimum, and Maximum data boxes just below the graph. To assist you in your analysis, click the Highlight button on the toolbar. Doing so will highlight the appropriate line on the graph when you select the counter in the legend.

Memory

To begin with, let's look at the counters under the Memory category. You'll start by selecting the AvailableMBytes counter. This counter shows you the amount of physical memory that is available to any processes running on the computer during the time period. By looking at the values in the Minimum and Maximum boxes you can see how the amount of physical memory fluctuated in relation to the other items. In an optimal situation, the values in both the Average and Minimum boxes should be more than 4MB.

Next, click the Pages/sec counter in the legend. This counter indicates the number of pages being read from or written to virtual memory in order to resolve accesses to data that was not in physical memory at the time of the reference. In an optimal situation, the values in both the Average and Maximum boxes should be less than 20.

If the AvailableMBytes counter values are under 4MB and the Pages/sec counter values are over 20, this is a good indication that the system needs more memory.

Server

The counters in the Server category deal directly with the amount of and use of physical memory. To begin with, the Pool Nonpaged Failures and Pool Paged Failures indicate the number of times that the operating system couldn't find any available memory in either of the pools of physical memory.

In an optimal situation, the values of both these counters should be 0. Any values above 0 indicate that the system needs more memory.

Now, the Pool Nonpaged Peak counter indicates the maximum size, in bytes, of the nonpaged pool that the system had in use at any one point. The value of this counter is a key figure in evaluating memory because it indicates how much physical memory the computer should have for optimal performance.

Paging File

The % Usage counter simply indicates the percentage of the page file that is in use during the monitoring session. Values between 50 and 75 are pretty standard fare.

However, if the value approaches 100, this could indicate either of two situations: First, the size of the paging file is simply too small. Second, the paging file is being used excessively because there's not enough physical memory in the system. To determine which is the case, you'll need to look closely at what the other counters are showing.

Physical Disk

Since the act of paging data from physical to virtual memory involves writing and reading to the hard disk, keeping an eye on the physical disk for increased activity can also help confirm the need for more memory. The % Disk Time counter will show the percentage of time that the system has spent reading and writing data. Standard disk reading and writing operations, such as opening, saving, and closing files is usually sporadic and won't really result in a high percentage. So, if you do see high values from the % Disk Time counter, you can bet that the system is spending a lot of time paging.

If you do see high values from the % Disk Time counter, chances are good that you'll also see high values from the Current Disk Queue Length counter. This counter shows how much data is in the queue waiting to be written to or read from the disk and a high value indicates a lot of data is being transferred back and forth between physical and virtual memory.

The Avg. Disk Sec/Transfer counter shows the amount of time that the average disk transfer requires in seconds. While this value alone doesn't show a lot as far as memory usage goes, when you multiply it by the Pages/sec counter value, it does bring into focus another good indicator. If the product is greater than 0.1, then paging is taking more that 10 percent of the system's disk access time.

Using a log

Even though I advocate using a brief-burst-mode time period, the Memory Tracker is set up so that you can use the Performance Logs and Alerts feature to track memory usage over a longer time period. To do so, you'll access the Performance Logs and Alerts snap-in, choose the Percentages Log, and click the Start the Selected Log button on the toolbar. When you're finished logging data, just click the Stop the Selected Log button on the toolbar. You can then select the Log Viewer snap-in and click the View Log Data button on the toolbar.

Stay on top of the latest Microsoft Windows tips and tricks with TechRepublic's Windows Desktop newsletter, delivered every Monday and Thursday. Automatically sign up today!

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

8 comments
sacbrat54
sacbrat54

Additionally, I would like to see if there is a way to construct and view/save reports that can show the breakdown of each application's use of RAM/HD memory i.e., Windows, web browser, MS Word, utilities, etc. by name, at any given time...and more detail about the Windows page file re same. Probably another article? :) LLM

stone_free
stone_free

In the last section "Using a log", I can't find the "Percentages Log". Also you don't explain what the second System Monitor Control called "Log Viewer" is for.

sacbrat54
sacbrat54

> If I may; now that I am looking further, I realize that it is probably best to re-config the data info each time, and easily done, so that I can use less or more choices each session, and as I become more familiar with the procedure and what I am looking at, it will all make much more sense. Right? Once again, this is really super. Thanks again. I am always happy to get the stuff y'all offer up at TR! THX1138 Greg for this tutorial. Took me a second to get the drift...:) Larry Miller

Mark W. Kaelin
Mark W. Kaelin

Do you monitor the overall performance of your workstations on a regular basis?

aandruli
aandruli

Has to break down to ap, otherwise you might know your memory is not being properly utilized but you won't know why or how to fix it

TheShawnThomas
TheShawnThomas

Never really have but need to start using something like this as a troubleshooting tool being that XP is aging but a lot of companies are refusing to move on. Some systems can't be upgraded further and this might show them (proof!) that there is nothing that can be done to improve the system speed barring switching to Linux. But the main reason some are staying with XP is custom apps not compatible with Win7 or Linux. Speaking of which, can anyone recommend a tool for XP that will test hardware in a manner similar to the Windows Experience Index? Just something quick that will evaluate a system and say your RAM and CPU are OK but the reason for your slowdown is because your harddrive sucks. It really takes too much time to manually look over specs to try to determine which are the better systems that I should keep around or "this one is old" but if I just upgrade the X then it could last us a little longer. Thanks!