jcmd 是重新组合jmap,jsp等实用程序的有前途的工具...
你可以找到introduction和man page,但它仍然很轻。
在网络上,我发现了显然存在的命令,例如 GC.heap_info ,我从来没有能够用于我的测试。
其中一些命令需要特殊标志。例如,-XX:NativeMemoryTracking=detail
将为您提供VM.native_memory
命令。
但是对于其他人来说,它不清楚如何激活它们或者它是否取决于jdk版本等。
我甚至找不到现有命令的详尽清单。
任何信息?
修改的 感谢@apangin response,我开始计算jvm版本可用命令的简短摘要。
免责声明:它仅来自代码拆解,而不是真正的测试
仅限附加
答案 0 :(得分:5)
基于@EricWang's answer,HotSpot diagnostic command sources和个人经验,我已经创建了JDK 8u121中可用的jcmd
命令的完整列表,以及有关要求的其他详细信息等。
有关特定命令的更多信息,请使用help <command>
。没有参数,这将显示可用命令的列表。 help -all
将显示所有命令的帮助。
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正常运行时间。
Options: (options must be specified using the <key> or <key>=<value> syntax)
-date : [optional] Add a prefix with current date (BOOLEAN, false)
打印VM标记选项及其当前值。
Options: (options must be specified using the <key> or <key>=<value> syntax)
-all : [optional] Print all flags supported by the VM (BOOLEAN, false)
打印系统属性。
打印用于启动此VM实例的命令行。
打印JVM版本信息。
打印本机内存使用情况。
-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)
显示商业功能的状态。
解锁商业功能。
使用stacktraces打印所有线程。
Options: (options must be specified using the <key> or <key>=<value> syntax)
-l : [optional] print java.util.concurrent locks (BOOLEAN, false)
调用java.lang.System.gc()。
调用java.lang.System.runFinalization()。
强制旋转GC日志文件。
-Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num>
提供有关Java类元数据的统计信息。
-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)
提供有关Java堆使用情况的统计信息。
Options: (options must be specified using the <key> or <key>=<value> syntax)
-all : [optional] Inspect all objects, including unreachable objects (BOOLEAN, false)
生成Java堆的HPROF格式转储。
-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)
启动本地管理代理。
启动远程管理代理。
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)
停止远程管理代理。
开始新的JFR录制
-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录制
-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记录的内容复制到文件。必须指定名称或记录ID。
-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记录
-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)
答案 1 :(得分:1)
<element [mydata]="Value"></element>
本身在应用于特定Java进程时提供此类信息,并且可选地提供特定的子命令。
如何获得帮助
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'element',
templateUrl: './element.component.html',
styleUrls: ['./element.component.scss'],
})
export class ElementComponent implements OnInit {
@Input() public mydata:string;
ngOnInit() {
console.log(this.mydata);
}
}
或jcmd
获取java进程列表,如果你还不知道目标java进程的pid,(例如我将使用pid进行java进程<强> 8976 以后续步骤为例。 jps
子命令,例如jcmd -l
,它将列出该进程的可用子命令。help
,它将打印jcmd 8976 help
子命令的帮助。jcmd 8976 help Thread.print
或Thread.print
顺便提一下,正如您所提到的,以下链接简要描述了jcmd命令:https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr006.html