jvm中常见的指令笔记

jhsdb jmap --heap --pid 7620  查看对应的pid的jvm内存信息

--heap to print java heap summary
--binaryheap to dump java heap in hprof binary format
--dumpfile name of the dump file
--histo to print histogram of java object heap
--clstats to print class loader statistics
--finalizerinfo to print information on objects awaiting finalization
--exe executable image name
--core path to coredump
--pid pid of process to attach
jhsdb
You use the jhsdb tool to attach to a Java process or to a core dump from a crashed Java Virtual Machine (JVM).

jhsdb is a Serviceability Agent (SA) tool. Serviceability Agent (SA) is a JDK component used to provide snapshot debugging, performance analysis and to get an in-depth understanding of the Hotspot JVM and the Java application executed by the Hotspot JVM.

Even though native debuggers like gdb are available for examining the JVM, unlike jhsdb, these native debuggers do not have an inbuilt understanding of the data structures in Hotspot and hence, are not able to throw insights on the Java application being executed. jhsdb knows about the locations and address ranges of crucial components of the JVM like the Java heap, heap generations, regions, code cache, etc.

Synopsis

Copyjhsdb clhsdb [--pid pid | --exe executable --core coredump]
Copyjhsdb debugd [options] (pid | executable coredump) [server-id]
Copyjhsdb hsdb [--pid pid | --exe executable --core coredump]
Copyjhsdb jstack [--pid pid | --exe executable --core coredump] [options]
Copyjhsdb jmap [--pid pid | --exe executable --core coredump] [options]
Copyjhsdb jinfo [--pid pid | --exe executable --core coredump] [options]
Copyjhsdb jsnap [options] [--pid pid | --exe executable --core coredump] 
pid
The process ID to which the jhsdb tool should attach. The process must be a Java process. To get a list of Java processes running on a machine, use the ps command or, if the JVM processes are not running in a separate docker instance, the jps command.

Note:JDK 10 added support for using the Attach API when attaching to Java processes running in a separate docker process. However, the jps command will not list the JVM processes that are running in a separate docker instance. If you are trying to connect a Linux host with a Virtual Machine that is in a docker container, you must use tools such as ps to look up the PID of the JVM.
server-id
An optional unique ID to use when multiple debug servers are running on the same remote host.

executable
The Java executable file from which the core dump was produced.

coredump
The core file to which the jhsdb tool should attach.

options
The command-line options for a jhsdb mode. See Common Options for jhsdb Modes, Options for the debugd Mode, Options for the jinfo Mode, Options for the jmap Mode, Options for the jmap Mode, Options for the jstack Mode, and Options for the jsnap Mode.

Note:Either the pid or the pair of executable and coredump files must be provided.
Description

You can use the jhsdb tool to attach to a Java process or to launch a postmortem debugger to analyze the content of a core-dump from a crashed Java Virtual Machine (JVM). This command is experimental and unsupported.

Note:Attaching the jhsdb tool to a live process will cause the process to hang and the process will probably crash when the debugger detaches.
The jhsdb tool can be launched in any one of the following modes:

jhsdb clhsdb
Starts the interactive command-line debugger.

jhsdb debugd
Starts the remote debug server.

jhsdb hsdb
Starts the interactive GUI debugger.

jhsdb jstack
Prints stack and locks information.

jhsdb jmap
Prints heap information.

jhsdb jinfo
Prints basic JVM information.

jhsdb jsnap
Prints performance counter information.

Common Options for jhsdb Modes

In addition to any required jstack, jmap, jinfo or jsnap mode specific options, the pid, exe, or core options must be provided for all modes. The following options are available for all modes.

--pid
The process ID of the hanging process.

--exe
The executable file name.

--core
The core dump file name.

--help
Displays the options available for the command.

Options for the debugd Mode

server-id
An optional unique ID for this debug server. This is required if multiple debug servers are run on the same machine.

Options for the jinfo Mode

Without specified options, the jhsdb jinfo command prints both flags and properties.

--flags
Prints the VM flags.

--sysprops
Prints the Java system properties.

no option
Prints the VM flags and the Java system properties.

Options for the jmap Mode

In addition to the following mode specific options, the pid, exe, or core options described in Common Options for jhsdb Modes must be provided.

no option
Prints the same information as Solaris pmap.

--heap
Prints the java heap summary.

--binaryheap
Dumps the java heap in hprof binary format.

--dumpfile
The name of the file to which the information needs to be written.

--histo
Prints the histogram of java object heap.

--clstats
Prints the class loader statistics.

--finalizerinfo
Prints the information on objects awaiting finalization.

Options for the jstack Mode

In addition to the following mode specific options, the pid, exe, or core options described in Common Options for jhsdb Modes must be provided.

--locks
Prints the java.util.concurrent locks information.

--mixed
Attempts to print both java and native frames if the platform allows it.

Options for the jsnap Mode

In addition to the following mode specific option, the pid, exe, or core options described in Common Options for jhsdb Modes must be provided.

--all
Prints all performance counters.

猜你喜欢

转载自www.cnblogs.com/guosai1500581464/p/13401653.html