jps - see all the PID's of all Java processes running on the machine
$ jps
11767 Jps
6854 Main
8205 Bootstrap
jstat - See how many classes are loaded by JVM for a Java program
$ jstat -class [pid]
Loaded Bytes Unloaded Bytes Time
10271 12074.2 0 0.0 11.10
jstack - Create thread dump
$ jstack [pid]
Useful usage of jmap
See summary of the heap memory
$ jmap -heap [pid]
Dump a heap file
$ jmap -dump:binary=b,file=[filename.dump] [pid]
Dump a heap file with only live objects
$ jmap -dump:live,binary=b,file=
Number of objects of a specific type
$ jmap -histo [pid] | grep org.example.MyClass
jinfo - To see system properties and VM flags
$ jinfo [pid]
Visual tools
jconsole - Graphical management console to see a number of attributes and graphs of a Java program. Simple usage:
$ jconsole [pid]
jvisualvm - This is newer than jconsole. Thread dump and heap dump creator and profiler for heap dump. This is also a monitoring tool like jconsole.
jhat - See the heap created. (probably this is not a very useful one. Some profiler/jvisualvm can be used)
$ jhat -port 8081 now.heap
1 comment:
Hi Nahian,
this is Torstein posting anonymously on your blog!
Post a Comment