gpt4 book ai didi

java - jcmd VM.set_flag,哪些标志是可写的?

转载 作者:搜寻专家 更新时间:2023-10-31 19:59:55 29 4
gpt4 key购买 nike

我正在尝试使用 jcmd VM.set_flag 选项进行试验。但是遇到一个错误,说“只能设置‘可写’标志”。什么是可写标志?

获取我的进程号:

XXX@XXX-Air:~/javacode$ jcmd -l
6294 Test
6295 jdk.jcmd/sun.tools.jcmd.JCmd -l

尝试更改 vm 标志:

XXX@XXX-Air:~/javacode$ jcmd 6294 VM.set_flag ConcGCThreads 4
6294:
only 'writeable' flags can be set
XXX@XXX-Air:~/javacode$ jcmd 6294 VM.set_flag MaxNewSize 1G
6294:
only 'writeable' flags can be set

编辑:它适用于可管理的标志,下面是成功的命令。

 XXXX@XXX-Air:~/javacode$ jcmd 11441 VM.flags -all | grep MinHeapFreeRatio
uintx MinHeapFreeRatio = 40 {manageable} {default}
XXXX@XXX-Air:~/javacode$ jcmd 11441 VM.set_flag MinHeapFreeRatio 45
11441:
Command executed successfully
XXXX@XXX-Air:~/javacode$ jcmd 11441 VM.flags -all | grep MinHeapFreeRatio
uintx MinHeapFreeRatio = 45

最佳答案

可写标志标记为{manageable}

您可以使用 jcmd 12345 VM.flags -all 列出所有标志。然后您可以 grep 寻找可管理的(在我的 Oracle jdk8 VM 上):

$ jcmd 12345 VM.flags -all | grep manageable
intx CMSAbortablePrecleanWaitMillis = 100 {manageable}
intx CMSTriggerInterval = -1 {manageable}
intx CMSWaitDuration = 2000 {manageable}
bool HeapDumpAfterFullGC = false {manageable}
bool HeapDumpBeforeFullGC = false {manageable}
bool HeapDumpOnOutOfMemoryError = false {manageable}
ccstr HeapDumpPath = {manageable}
uintx MaxHeapFreeRatio = 100 {manageable}
uintx MinHeapFreeRatio = 0 {manageable}
bool PrintClassHistogram = false {manageable}
bool PrintClassHistogramAfterFullGC = false {manageable}
bool PrintClassHistogramBeforeFullGC = false {manageable}
bool PrintConcurrentLocks = false {manageable}
bool PrintGC = false {manageable}
bool PrintGCDateStamps = false {manageable}
bool PrintGCDetails = false {manageable}
bool PrintGCID = false {manageable}
bool PrintGCTimeStamps = false {manageable}

关于java - jcmd VM.set_flag,哪些标志是可写的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46785304/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com