(1) JMAP
1. Role
The print process, the core file, and the remote process's shared object store the map or heap storage details.
1. Role
Jmap [Options] pidjmap [options] Executable corejmap [options] [PID] [email protected]] Remote-hostname-or-ip
If the specified process is running on a 64-bit Java Virtual machine (JVM), you may need to specify the-J-D64 option, for example: Jmap-j-d64-heap pid.
3. Parameter options
3.1 <no option>
When you do not use the option, the Jmap command prints the shared object mappings
Such as
c:\users\administrator>jmap 9208attaching to process id 9208, please Wait ... Debugger attached successfully. Server compiler detected. jvm version is 24.75-b040x00000000623c0000 8016k d:\java\jdk1.7.0_75\jre\bin\server\jvm.dll0x0000000062ba0000 840k D:\Java\jdk1.7.0_75\jre\bin\msvcr100.dll0x0000000062cc0000 144K D:\Java\jdk1.7.0_75\jre\bin\sunec.dll0x0000000062cf0000 68k d:\java\jdk1.7.0_75\jre\bin\nio.dll0x0000000062d10000 100k d:\java\jdk1.7.0_75\jre\bin\ Net.dll0x0000000062d30000 160k d:\java\jdk1.7.0_75\ jre\bin\java.dll0x00000000634d0000 84k d:\java\jdk1.7.0_75\jre\bin\zip.dll0x0000000065950000 44K D:\Java\jdk1.7.0_75\jre\bin\sunmscapi.dll0x0000000065960000 60k d:\java\jdk1.7.0_75\jre\bin\ Verify.dll0x0000000065970000 44k d:\java\ Jdk1.7.0_75\jre\bin\management.dll ...
3.2
-dump:[live,] format=b, File=filename
Dumps the Java heap in hprof binary format. Specifies live, which identifies the object that dumps the active state. The resulting file can be viewed by the jhat command.
C:\users\administrator>jmap-dump:format=b,file=9208_0413.hprof 9208Dumping Heap to C:\Users\Administrator\9208_ 0413.hprof ... Heap dump file created
3.3-finalizerinfo
Print information about the object that will end
C:\users\administrator>jmap-finalizerinfo 9208Attaching to process ID 9208, please wait ... Debugger attached successfully. Server compiler detected. JVM version is 24.75-b04number of objects pending for finalization:0
3.4-heap
Print garbage collection and heap summary information, and build heap summaries used by the -wise Heap
c:\users\administrator>jmap -heap 9208attaching to process id 9208, Please wait ... Debugger attached successfully. Server compiler detected. Jvm version is 24.75-b04using thread-local object allocation. Parallel gc with 4 thread (s) heap configuration: minheapfreeratio = 0 MaxHeapFreeRatio = 100 MaxHeapSize = 2124414976 (2026.0MB) NewSize = 1310720 (1.25MB) MaxNewSize = 17592186044415 MB OldSize = 5439488 (5.1875MB) NewRatio = 2 survivorratio = 8 permsize = 21757952 (20.75MB) maxpermsize = 85983232 (82.0MB) G1HeapRegionSize = 0 (0.0MB) heap usage:ps Young GenerationEden Space: capacity = 68157440 (65.0MB) used = 16646688 (15.875518798828125MB) free = 51510752 (49.124481201171875MB) 24.423875075120193% usedfrom space: capacity = 5242880 (5.0MB) used = 5228248 (4.986045837402344MB) free = 14632 (0.01395416259765625MB) 99.72091674804688% usedto space: capacity = 15728640 (15.0MB) used = 0 (0.0MB) free = 15728640 (15.0MB) 0.0% usedPS Old Generation capacity = 88080384 (84.0MB) used = 27239848 (25.977943420410156MB) free = 60840536 (58.022056579589844MB) 30.9261231195359% usedPS Perm Generation capacity = 22020096 (21.0MB) used = 15369592 (14.657585144042969MB) free = 6650504 (6.342414855957031MB) 69.7980244954427% used10057 interned strings occupying 867832 bytes.
3.5-histo[:live]
Histogram of the print heap
num #instances # Bytes class name---------------------------------------------- ... 877: 1 32 [Lcom.sun.jndi.ldap.pool.Pool; 878: 2 32 com.sun.org.apache.xerces.internal.impl.dv.dtd.entitydatatypevalidator 879: 2 32 java.lang.Shutdown$Lock 880: 1 32 org.apache.coyote.http11.http11protocol$ http11connectionhandler 881: 2 32 com.sun.org.apache.xerces.internal.impl.xmldocumentscannerimpl$dtddriver 882: 1 32 java.lang.reflect.WeakCache$CacheKey 883: 1 32 java.text.FieldPosition 884: 1 32 java.util.concurrent.atomic.atomicreferencefieldupdater$atomicreferencefieldupdaterimpl 885: 2 32 sun.security.x509.CertificateVersion 886: 2 32 [Lorg.apache.catalina.deploy.ContextEnvironment; 887: 1 32 [lorg.apache.tomcat.util.net.abstractendpoint$acceptor$acceptorstate; 888 : 1 &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;32&NBSP;&NBSP;SUN.NIO.CS.STANDARDCHARSETS&NBSP, .....
3.6-clstats
Wise statistics for the Java heap. 1.7.0_75 does not support this item
(2) Jhat
2.1 Effects
Parses the Java heap. The Jhat command parses the Java heap dump file and starts the Web server. The Jhat command allows you to browse the heap dumps. Supports OQL syntax.
2.2 Use
jhat [Options] Heap-dump-file
2.3 Parameter Description
1.-stack False|true
Closes the trace object allocation call stack. The default value is true.
-refs False|true
Turns off tracing of references to objects. The default is true.
-port Port-number
Set the port's Jhathttp server. The default value is 7000.
-exclude Exclude-file
Specifies that files that should exclude data members from accessible object queries are listed
-baseline Exclude-file
Specifies the base heap dump. A heap dump object with the same object ID two is marked as not a new object. This is useful for comparing two different heap dumps.
-debug int
Level 0 indicates no debug output
C:\users\administrator>jhat-port 8000 9208_0413.hprofreading from 9208_0413.hprof ... Dump file created Thu Apr 21:18:58 CST 2017Snapshot Read, resolving ... Resolving 389761 objects ... Chasing references, expect .... ... ... ... ... ... ... ... ... ... ... ... ... .... ... .... ... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... .... ..... Eliminating duplicate references ......... ................... ....................... ........ Snapshot resolved. Started HTTP Server on port 8000Server are ready.
Next, you can access the view through the browser. Http://localhost:8000/.
(3) Jinfo
3.1 Effects
The configuration information that is generated. If the specified process is running on a 64-bit JVM, you may need to specify the-J-D64 option
3.2 Use
jinfo [option] pidjinfo [option] executable corejinfo [option] [Servier-id] Remote-hostname-or-ip
3.3 Option Parameters
No-option: Both the command line flag and the System property key-value pair are printed.
-flag Name
The print name and the value of the specified command-line flag.
-flag [+|-]name
Opens or disables the specified Boolean command-line flag.
-flag Name=value
Sets the specified command-line flag to the specified value.
-flags
The Print command line flag is passed to the JVM.
-sysprops
Print Java System property key-value pairs.
Command-line arguments for the print process
C:\users\administrator>jinfo-flags 9208Attaching to process ID 9208, please wait ... Debugger attached successfully. Server compiler detected. JVM version is 24.75-b04-djava.util.logging.config.file=d:\apache-tomcat-7.0.67\conf\logging.properties- Djava.util.logging.manager=org.apache.juli.classloaderlogmanager-djava.endorsed.dirs=d:\apache-tomcat-7.0.67\ Endorsed-dcatalina.base=d:\apache-tomcat-7.0.67-dcatalina.home=d:\apache-tomcat-7.0.67-djava.io.tmpdir=d:\ apache-tomcat-7.0.67\temp# in catalina.sh can be found in the settings of the place
Printing parameter values
#值类型参数C: \users\administrator>jinfo-flag NewSize 9208-xx:newsize=1310720# switch type parameter c:\users\administrator>jinfo -flag PRINTGC 9208-xx:-P rintgcc:\users\administrator>jinfo-flag Xmn 9208no such flag ' Xmn '
It can be concluded that the-XMS,-XMN series parameters cannot be specified or printed through jinfo; Jinfo commands function in-xx:*** format.
Setting parameter values
C:\users\administrator>jinfo -flag printgc 9208-xx:-P Rintgcc:\users\administrator>jinfo -flag +printgc 9208c:\users\administrator>jinfo -flag printgc 9208-xx:+ Printgc//2 windows Environment always fails c:\users\administrator>jinfo -flag permsize=21750000 9208exception in thread "Main" java.io.IOException: Command failed in target vm at Sun.tools.attach.WindowsVirtualMachine.execute (windowsvirtualmachine.java:112) at sun.tools.attach.hotspotvirtualmachine.executecommand (HotSpotVirtualMachine.java:217 ) at sun.tools.attach.hotspotvirtualmachine.setflag ( hotspotvirtualmachine.java:190) at Sun.tools.jinfo.JInfo.flag (jinfo.java:123) at Sun.tools.jinfo.JInfo.main (jinfo.java:76)
Http://docs.oracle.com/javase/8/docs/technotes/tools/unix/jhat.html
Http://docs.oracle.com/javase/8/docs/technotes/tools/unix/jinfo.html
Http://docs.oracle.com/javase/8/docs/technotes/tools/unix/jmap.html
This article is from a "simple" blog, so be sure to keep this source http://dba10g.blog.51cto.com/764602/1915801
Java comes with command-line tools (Jmap,jhat,jinfo)