Mustgather: Monitoring Java Processes on Windows using PerfMon

Technote (troubleshooting)


Problem(Abstract)

The PerfMon tool is packaged as part of the Windows operating system and can be used to monitor a wide variety of counters, including those related to the process size and virtual address space usage.The information below shows how to enable monitoring for the various data types useful in debugging.

Resolving the problem

PerfMon

PerfMon can usually be started by typing perfmon on the command line.
Alternatively, PerfMon can be activated using the following:
Control Panel -> Administrative Tools -> Performance

Activating PerfMon Logging

1. Expand Performance logs and alerts
2. Right-click on Counter Logs and select New Log Settings.
3. Enter a name for the log and select the OK button.

This causes any output to immediately start logging to the log file specified above.

Monitoring the Process Size

Monitoring the process size makes it possible to determine if an OutOfMemoryError is caused by the exhaustion of the virtual address space, which is a strong indication of a "native" memory leak rather than one involving Java objects.
The following instructions allow the process size to be monitored.

1. Select the + button on the toolbar.
2. Select the Process performance object
3. Select Virtual Bytes from the counters list
4. Select the instance for the Java process to monitor
5. Select Add and then Close

Monitoring the CPU Usage

It is often useful to be able to monitor the CPU usage of a Java application, or indeed for the machine on which the Java application is running, to be able to determine performance problems.
The information below will allow you to monitor and log information on CPU usage.

1. Select the + button on the toolbar.
2. Select the Thread performance object
3. Select the following counters from the list:

  • % Processor Time
  • ID Process
  • ID Thread
4. Select the instance of the Java process to monitor
Ensure that you select all of the Java threads
5. Select Add and then Close

Monitoring the Paging Usage

It is often useful to be able to monitor the paging usage on a machine, as this will have a direct effect on the performance of a Java application working on that machine. The information below will allow you to monitor and log information on paging usage.

1. Select the + button on the toolbar.
2. Select the Memory performance object
3. Select the Pages/sec counter
4. Select Add and then Close

Stopping PerfMon Logging

In order to stop logging and obtain the log file, the following needs to be done:

1. Right-click Log Name in the counter window
2. Click Stop
3. The log file is referenced in the Log File Name column.


Rate this page:

(0 users)Average rating

Document information


More support for:

Runtimes for Java Technology
Debugging Tools

Software version:

5.0

Operating system(s):

Windows

Software edition:

J2SE

Reference #:

1222444

Modified date:

2010-02-21

Translate my page

Machine Translation

Content navigation