In short, we call this PerfMon. To start it, you can go to Control
Panel -> Administrative Tools and double click Performance. Or, you can
simply click on Start -> Run, type Perfmon and hit the Enter key. Before I
proceed further, let me tell you that Perfmon does take a few processor cycles
and disk space, since it logs a lot of details based on the counters you have
and the frequency with which you are logging. The idea here is not to let your
Perfmon run for ever and ever and waste your CPU cycles along with disk space,
but just to ensure that you have the counters added. Then, if there is any need
of data, you can just start/stop logging and do not miss the counters in a spur
of the moment.
NB: I am using Windows XP SP 2 to create this article and all the snapshots are
from the same machine.
How to create a Perfmon log?
* Start your
Performance Monitor.
* Expand Performance
Logs and Alerts.
* Right click on
Counter Logs and select New Log Settings.
* Give a
meaningful name and click on OK (I gave a name PerformanceCheckup).
Figure 1
You can change the Current Log File’s location, but the
interface will not allow you to do it unless you add a counter.
Click on Add Objects and select the following from the
dialog box which comes up (you can use Shift and CTRL keys here to select
multiple items).
Process
Processor
Memory
.NET CLR Data
.NET CLR Exceptions
.NET CLR Interop
.NET CLR Jit
.NET CLR Loading
.NET CLR LocksAndThreads
.NET CLR Memory
.NET CLR Networking
.NET CLR Remoting
.NET CLR Security
ASP.NET
ASP.NET Applications
ASP.NET State Service
If you have classic ASP application, you may like to add Active
Server Pages and Web Service counters as well.
After you have added the counters, click on Close button.
At this time you will notice that the other textboxes are no
longer grayed out. You can specify a time interval to sample the data. By
default, the interval is 15 seconds and is good for most purposes. But let us
say the issue is happening every 3 days. In that case, it will not make much
sense to log data every 15 seconds for all the counters. Probably 60 or 90
seconds will be a better choice. Hopefully, you get the idea. The thumb rule
is that too little data can make the Perfmon logs meaningless and too much data
can make it a little more difficult to analyze, but more data cannot hurt you
as much as less data, since less data is almost like no data!
Now, right click on your Perfmon Log file and choose Start. In
the screenshot below, you will find the PerformanceCheckup log file as green,
which means that now the tool is gathering data every N seconds you have just
configured in the last step.
Also, notice in the screenshot above that the name of the
Perfmon log file is C:\PerfLogs\PerformanceCheckup_000001.blg. As soon as you
stop and restart it, the Log File Name will change automatically to PerformanceCheckup_000002.
Therefore, your existing log files are not touched and you may archive it to
any storage medium.
Figure 2
Now that the counters are already added, you NEED NOT keep the
logging started all the time since it will just keep taking space on your
hard-disk. You may turn it on whenever you plan to fix any performance related
issues on your server. The Perfmon logs will give you a decent picture of what
is happening on your server. It is just a matter of getting yourself acquainted
with different counters and what they mean.
Here are a couple of fantastic article from Microsoft:
Performance
Counters for ASP.NET
Memory
Performance Counters