Useful tool: jrcmd (repost from old BEA blog)

The latest versions of JRockit include a utility called "jrcmd" which can be used to grab information from running JVMs as well as control the behaviour of the JVM. For example, it can be used to create thread stack dumps, print the heap usage, get the commandline used to start the JVM, enable the management console and a few other things.

In the most basic incarnation, jrcmd lists the currently running JVMs on the system:

> jrcmd
2512 org.eclipse.core.launcher.Main
1952 org.apache.tools.ant.launch.Launcher
The first number is the process id of the process followed by the name of the main class and any command line parameters.

Given the process id we can send some commands to that particular process. For example, to print a thread stack dump:

> jrcmd 1952 print_threads

===== FULL THREAD DUMP ===============
Mon Jan 03 10:27:53 2005

"Main Thread" id=1 idx=0x2 tid=256 prio=6 alive, in native
at org/eclipse/swt/internal/win32/OS.WaitMessage()Z(Native Method)
at org/eclipse/swt/widgets/Display.sleep()Z(Display.java:3108)
...
This is the same output you get when pressing Ctrl-Break or Ctrl-\, but this way you can get the information from a command line or from a script.

To see the list of available commands you can type 'help':

> jrcmd 1952 help
Go ahead and explore them! I will return to discuss some of the more interesting and useful commands.
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

A blog about the JRockit JVM and related topics

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today