简体   繁体   English

jcmd:我在哪里可以找到补充信息

[英]jcmd : where can I find complementary information

jcmd is a promising tool regrouping utilities of jmap, jsp, etc... jcmd是重组jmap,jsp等实用工具的有前途的工具......
You can find introduction and man page but still it's very light. 你可以找到介绍手册页,但它仍然很轻。

On the web, I found apparently existing commands like GC.heap_info , that I've never been able to use for my tests. 在网络上,我发现显然存在像GC.heap_info这样的命令,我从来没有能够用于我的测试。

Some of these commands need special flags. 其中一些命令需要特殊标志。 -XX:NativeMemoryTracking=detail will give you VM.native_memory command, for instance. -XX:NativeMemoryTracking=detail将为您提供VM.native_memory命令。

But for some others it's not clear how to activate them or if it depends of the jdk version, etc.. 但对于其他一些人来说,不清楚如何激活它们或者它是否取决于jdk版本等。
I can't even find an exhaustive list of existing command. 我甚至找不到现有命令的详尽清单。

Any info? 任何信息?


Edit Thx to @apangin response , I've started to compute a short summary of available commands by jvm version. Thx 编辑@apangin响应 ,我已经开始通过jvm版本计算可用命令的简短摘要。

Disclaimer : it comes from code teardown only, not real test 免责声明:它仅来自代码拆解,而不是真正的测试

jdk8 jdk8

  • help 救命
  • VM.uptime [options] VM.uptime [选项]
  • VM.flags [options] VM.flags [选项]
  • VM.system_properties VM.system_properties
  • VM.command_line VM.command_line
  • VM.version VM.version
  • VM.native_memory [options] VM.native_memory [选项]
  • VM.check_commercial_features VM.check_commercial_features
  • VM.unlock_commercial_features VM.unlock_commercial_features
  • Thread.print [options] Thread.print [options]
  • GC.run GC.run
  • GC.run_finalization GC.run_finalization
  • GC.rotate_log GC.rotate_log
  • GC.class_stats [options] GC.class_stats [选项]
  • GC.class_histogram [options] GC.class_histogram [选项]
  • GC.heap_dump [options] GC.heap_dump [选项]
  • ManagementAgent.start_local ManagementAgent.start_local
  • ManagementAgent.start [options] ManagementAgent.start [选项]
  • ManagementAgent.stopJFR.start [options] ManagementAgent.stopJFR.start [options]
  • JFR.stop [options] JFR.stop [选项]
  • JFR.dump [options] JFR.dump [选项]
  • JFR.check [options] JFR.check [选项]

jdk9 jdk9

only the additional 只有额外的

  • VM.set_flag [options] VM.set_flag [选项]
  • VM.info VM.info
  • VM.class_hierarchy [options] VM.class_hierarchy [options]
  • VM.dynlibs VM.dynlibs
  • VM.print_touched_methods VM.print_touched_methods
  • JVMTI.data_dump JVMTI.data_dump
  • JVMTI.agent_load [options] JVMTI.agent_load [options]
  • GC.finalizer_info GC.finalizer_info
  • GC.heap_info GC.heap_info
  • ManagementAgent.status ManagementAgent.status
  • ManagementAgent.stop ManagementAgent.stop
  • Compiler.queue Compiler.queue
  • Compiler.codelist Compiler.codelist
  • Compiler.codecache Compiler.codecache
  • Compiler.directives_print Compiler.directives_print
  • Compiler.directives_remove Compiler.directives_remove
  • Compiler.directives_add [options] Compiler.directives_add [options]
  • Compiler.directives_clear Compiler.directives_clear

Basing on @EricWang's answer , HotSpot diagnostic command sources and the personal experience, I've created the full list of jcmd commands available in JDK 8u121 with the additional details about requirements etc. 基于@ EricWang的回答HotSpot诊断命令源和个人经验,我已经创建了JDK 8u121中可用的jcmd命令的完整列表, jcmd有关需求等的其他详细信息。


help [options] [<command name>] 帮助[选项] [<命令名>]

For more information about a specific command use help <command> . 有关特定命令的更多信息,请使用help <command> With no argument this will show a list of available commands. 没有参数,这将显示可用命令的列表。 help -all will show help for all commands. help -all将显示所有命令的帮助。

  • Impact: Low 影响:低
Arguments:
    command name : [optional] The name of the command for which we want help (STRING, no default value)

Options: (options must be specified using the <key> or <key>=<value> syntax)
    -all : [optional] Show help for all commands (BOOLEAN, false)

VM.uptime [options] VM.uptime [选项]

Print VM uptime. 打印VM正常运行时间

  • Impact: Low 影响:低
Options: (options must be specified using the <key> or <key>=<value> syntax)
    -date : [optional] Add a prefix with current date (BOOLEAN, false)

VM.flags [options] VM.flags [选项]

Print VM flag options and their current values. 打印VM标志选项及其当前值。

  • Impact: Low 影响:低
Options: (options must be specified using the <key> or <key>=<value> syntax)
    -all : [optional] Print all flags supported by the VM (BOOLEAN, false)

VM.system_properties VM.system_properties

Print system properties. 打印系统属性。

  • Impact: Low 影响:低

VM.command_line VM.command_line

Print the command line used to start this VM instance. 打印用于启动此VM实例的命令行。

  • Impact: Low 影响:低

VM.version VM.version

Print JVM version information. 打印JVM版本信息。

  • Impact: Low 影响:低

VM.native_memory [options] VM.native_memory [选项]

Print native memory usage. 打印本机内存使用量。

  • Impact: Medium 影响:中等
  • Requires: -XX:NativeMemoryTracking=[summary|detail] 需要: -XX:NativeMemoryTracking=[summary|detail]
Options: (options must be specified using the <key> or <key>=<value> syntax)
    summary : [optional] request runtime to report current memory summary, which includes total reserved and committed memory, along with memory usage summary by each subsytem. (BOOLEAN, false)
    detail : [optional] request runtime to report memory allocation >= 1K by each callsite. (BOOLEAN, false)
    baseline : [optional] request runtime to baseline current memory usage, so it can be compared against in later time. (BOOLEAN, false)
    summary.diff : [optional] request runtime to report memory summary comparison against previous baseline. (BOOLEAN, false)
    detail.diff : [optional] request runtime to report memory detail comparison against previous baseline, which shows the memory allocation activities at different callsites. (BOOLEAN, false)
    shutdown : [optional] request runtime to shutdown itself and free the memory used by runtime. (BOOLEAN, false)
    statistics : [optional] print tracker statistics for tuning purpose. (BOOLEAN, false)
    scale : [optional] Memory usage in which scale, KB, MB or GB (STRING, KB)

VM.check_commercial_features VM.check_commercial_features

Display status of commercial features. 显示商业功能的状态。

  • Impact: Low: No impact 影响:低:没有影响

VM.unlock_commercial_features VM.unlock_commercial_features

Unlock commercial features. 解锁商业功能。

  • Impact: Low: No impact 影响:低:没有影响

Thread.print [options] Thread.print [options]

Print all threads with stacktraces. 使用stacktraces打印所有线程。

  • Impact: Medium: Depends on the number of threads. 影响:中:取决于线程数。
Options: (options must be specified using the <key> or <key>=<value> syntax)
    -l : [optional] print java.util.concurrent locks (BOOLEAN, false)

GC.run GC.run

Call java.lang.System.gc(). 调用java.lang.System.gc()。

  • Impact: Medium: Depends on Java heap size and content. 影响:中:取决于Java堆大小和内容。

GC.run_finalization GC.run_finalization

Call java.lang.System.runFinalization(). 调用java.lang.System.runFinalization()。

  • Impact: Medium: Depends on Java content. 影响:中:取决于Java内容。

GC.rotate_log GC.rotate_log

Force the GC log file to be rotated. 强制旋转GC日志文件。

  • Impact: Low 影响:低
  • Requires: -Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num> 需要: -Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num>

GC.class_stats [options] [<columns>] GC.class_stats [options] [<columns>]

Provide statistics about Java class meta data. 提供有关Java类元数据的统计信息。

  • Impact: High: Depends on Java heap size and content. 影响:高:取决于Java堆大小和内容。
  • Requires: -XX:+UnlockDiagnosticVMOptions 需要: -XX:+UnlockDiagnosticVMOptions
Arguments:
    columns : [optional] Comma-separated list of all the columns to show. If not specified, the following columns are shown: InstBytes,KlassBytes,CpAll,annotations,MethodCount,Bytecodes,MethodAll,ROAll,RWAll,Total (STRING, no default value)

Options: (options must be specified using the <key> or <key>=<value> syntax)
    -all : [optional] Show all columns (BOOLEAN, false)
    -csv : [optional] Print in CSV (comma-separated values) format for spreadsheets (BOOLEAN, false)
    -help : [optional] Show meaning of all the columns (BOOLEAN, false)

GC.class_histogram [options] GC.class_histogram [选项]

Provide statistics about the Java heap usage. 提供有关Java堆使用情况的统计信息。

  • Impact: High: Depends on Java heap size and content. 影响:高:取决于Java堆大小和内容。
Options: (options must be specified using the <key> or <key>=<value> syntax)
    -all : [optional] Inspect all objects, including unreachable objects (BOOLEAN, false)

GC.heap_dump [options] <filename> GC.heap_dump [options] <filename>

Generate a HPROF format dump of the Java heap. 生成Java堆的HPROF格式转储。

  • Impact: High: Depends on Java heap size and content. 影响:高:取决于Java堆大小和内容。 Request a full GC unless the -all option is specified. 除非指定了-all选项,否则请求完整的GC。
Arguments:
    filename : Name of the dump file (STRING, no default value)

Options: (options must be specified using the <key> or <key>=<value> syntax)
    -all : [optional] Dump all objects, including unreachable objects (BOOLEAN, false)

ManagementAgent.start_local ManagementAgent.start_local

Start local management agent. 启动本地管理代理。

  • Impact: Low: No impact 影响:低:没有影响

ManagementAgent.start [options] ManagementAgent.start [选项]

Start remote management agent. 启动远程管理代理。

  • Impact: Low: No impact 影响:低:没有影响
Options: (options must be specified using the <key> or <key>=<value> syntax)
    config.file : [optional] set com.sun.management.config.file (STRING, no default value)
    jmxremote.host : [optional] set com.sun.management.jmxremote.host (STRING, no default value)
    jmxremote.port : [optional] set com.sun.management.jmxremote.port (STRING, no default value)
    jmxremote.rmi.port : [optional] set com.sun.management.jmxremote.rmi.port (STRING, no default value)
    jmxremote.ssl : [optional] set com.sun.management.jmxremote.ssl (STRING, no default value)
    jmxremote.registry.ssl : [optional] set com.sun.management.jmxremote.registry.ssl (STRING, no default value)
    jmxremote.authenticate : [optional] set com.sun.management.jmxremote.authenticate (STRING, no default value)
    jmxremote.password.file : [optional] set com.sun.management.jmxremote.password.file (STRING, no default value)
    jmxremote.access.file : [optional] set com.sun.management.jmxremote.access.file (STRING, no default value)
    jmxremote.login.config : [optional] set com.sun.management.jmxremote.login.config (STRING, no default value)
    jmxremote.ssl.enabled.cipher.suites : [optional] set com.sun.management.jmxremote.ssl.enabled.cipher.suite (STRING, no default value)
    jmxremote.ssl.enabled.protocols : [optional] set com.sun.management.jmxremote.ssl.enabled.protocols (STRING, no default value)
    jmxremote.ssl.need.client.auth : [optional] set com.sun.management.jmxremote.need.client.auth (STRING, no default value)
    jmxremote.ssl.config.file : [optional] set com.sun.management.jmxremote.ssl_config_file (STRING, no default value)
    jmxremote.autodiscovery : [optional] set com.sun.management.jmxremote.autodiscovery (STRING, no default value)
    jdp.port : [optional] set com.sun.management.jdp.port (INT, no default value)
    jdp.address : [optional] set com.sun.management.jdp.address (STRING, no default value)
    jdp.source_addr : [optional] set com.sun.management.jdp.source_addr (STRING, no default value)
    jdp.ttl : [optional] set com.sun.management.jdp.ttl (INT, no default value)
    jdp.pause : [optional] set com.sun.management.jdp.pause (INT, no default value)
    jdp.name : [optional] set com.sun.management.jdp.name (STRING, no default value)

ManagementAgent.stop ManagementAgent.stop

Stop remote management agent. 停止远程管理代理。

  • Impact: Low: No impact 影响:低:没有影响

JFR.start [options] JFR.start [选项]

Starts a new JFR recording 开始新的JFR录制

  • Impact: Medium: Depending on the settings for a recording, the impact can range from low to high. 影响:中:根据录制的设置,影响范围可以从低到高。
  • Requires: -XX:+UnlockCommercialFeatures 需要: -XX:+UnlockCommercialFeatures
Options: (options must be specified using the <key> or <key>=<value> syntax)
    name : [optional] Name that can be used to identify recording, e.g. "My Recording" (STRING, no default value)
    defaultrecording : [optional] Starts the default recording, can only be combined with settings. (BOOLEAN, false)
    dumponexit : [optional] Dump running recording when JVM shuts down (BOOLEAN, no default value)
    settings : [optional] Settings file(s), e.g. profile or default. See JRE_HOME/lib/jfr (STRING SET, no default value)
    delay : [optional] Delay recording start with (s)econds, (m)inutes), (h)ours), or (d)ays, e.g. 5h. (NANOTIME, 0)
    duration : [optional] Duration of recording in (s)econds, (m)inutes, (h)ours, or (d)ays, e.g. 300s. (NANOTIME, 0)
    filename : [optional] Resulting recording filename, e.g. "C:\Users\user\My Recording.jfr" (STRING, no default value)
    compress : [optional] GZip-compress the resulting recording file (BOOLEAN, false)
    maxage : [optional] Maximum time to keep recorded data (on disk) in (s)econds, (m)inutes, (h)ours, or (d)ays, e.g. 60m, or 0 for no limit (NANOTIME, 0)
    maxsize : [optional] Maximum amount of bytes to keep (on disk) in (k)B, (M)B or (G)B, e.g. 500M, or 0 for no limit (MEMORY SIZE, 0)

JFR.stop [options] JFR.stop [选项]

Stops a JFR recording 停止JFR录制

  • Impact: Low 影响:低
  • Requires: -XX:+UnlockCommercialFeatures 需要: -XX:+UnlockCommercialFeatures
Options: (options must be specified using the <key> or <key>=<value> syntax)
    name : [optional] Recording name,.e.g "My Recording" (STRING, no default value)
    recording : [optional] Recording number, see JFR.check for a list of available recordings (JLONG, -1)
    discard : [optional] Skip writing data to previously specified file (if any) (BOOLEAN, false)
    filename : [optional] Copy recording data to file, e.g. "C:\Users\user\My Recording.jfr" (STRING, no default value)
    compress : [optional] GZip-compress "filename" destination (BOOLEAN, false)

JFR.dump [options] JFR.dump [选项]

Copies contents of a JFR recording to file. 将JFR记录的内容复制到文件。 Either the name or the recording id must be specified. 必须指定名称或记录ID。

  • Impact: Low 影响:低
  • Requires: -XX:+UnlockCommercialFeatures 需要: -XX:+UnlockCommercialFeatures
Options: (options must be specified using the <key> or <key>=<value> syntax)
    name : [optional] Recording name, e.g. "My Recording" (STRING, no default value)
    recording : [optional] Recording number, use JFR.check to list available recordings (JLONG, -1)
    filename :  Copy recording data to file, i.e "C:\Users\user\My Recording.jfr" (STRING, no default value)
    compress : [optional] GZip-compress "filename" destination (BOOLEAN, false)

JFR.check [options] JFR.check [选项]

Checks running JFR recording(s) 检查运行JFR记录

  • Impact: Low 影响:低
  • Requires: -XX:+UnlockCommercialFeatures 需要: -XX:+UnlockCommercialFeatures
Options: (options must be specified using the <key> or <key>=<value> syntax)
    name : [optional] Recording name, e.g. "My Recording" or omit to see all recordings (STRING, no default value)
    recording : [optional] Recording number, or omit to see all recordings (JLONG, -1)
    verbose : [optional] Print event settings for the recording(s) (BOOLEAN, false)

jcmd itself provides such information when applied on a specific Java process, and optionally a specific sub command. jcmd本身在应用于特定Java进程时提供此类信息,并且可选地提供特定的子命令。

How to get help: 如何获得帮助:

  • First get java process lists via jps or jcmd -l , if you don't know the pid of target java process yet, (eg I will take java process with pid 8976 as example in subsequent steps). 首先通过jpsjcmd -l获取java进程列表,如果你还不知道目标java进程的pid, (例如我将在后续步骤中以pid 8976为例进行java进程)。
  • Then apply help sub command on a specific java process, eg jcmd 8976 help , it will list available sub commands for the process. 然后对特定的java进程应用help子命令,例如jcmd 8976 help ,它将列出该进程的可用子命令。
  • Then, get help for a specific command on the process, eg jcmd 8976 help Thread.print , it will print help of Thread.print sub command. 然后,获取有关该进程的特定命令的jcmd 8976 help Thread.print ,例如jcmd 8976 help Thread.print ,它将打印Thread.print子命令的帮助。
  • Then, execute the specific sub command on the process, eg jcmd 8976 Thread.print or jcmd 8976 Thread.print | less -N 然后,在进程上执行特定的子命令,例如jcmd 8976 Thread.printjcmd 8976 Thread.print | less -N jcmd 8976 Thread.print | less -N

By the way, just as you mentioned, following link describes jcmd command briefly: https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr006.html 顺便说一句,正如您所提到的,以下链接简要描述了jcmd命令: https ://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr006.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在哪里可以找到有关spring-security批注的更多信息 - Where can I find more information on spring-security annotations 在哪里可以找到有关数据存储行为的更多诊断信息? - Where can I find more diagnostic information about datastore behavior? 我在哪里可以找到有关 Sun 的 JVM 内部工作原理的信息? - Where can I find information about the inner workings of Sun's JVM? jcmd创建的堆转储文件在哪里? - Where is the heap dump file created by jcmd? 在哪里可以找到有关JVM二进制格式的信息,以便创建自己的JVM。 - Where can I find information for the JVM binary format in order to create my own JVM 在哪里可以找到有关将Java应用程序集成到Ubuntu应用程序指示器菜单中的信息? - Where can I find information on integrating Java applications into the Ubuntu application indicator menu? 在哪里可以找到有关AWT如何与本机操作系统交互的详细信息? - Where can I find detailed information on how AWT interacts with the native OS? 在 Java 中的数组中查找互补对 - Find complementary pairs in array in Java 在哪里可以找到ConnectivityMonitor()? - Where can I find ConnectivityMonitor()? 我在哪里可以找到 Selenium 接口的实现? - Where can I find the implementation of Selenium Interfaces?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM