mirror of https://github.com/alibaba/arthas.git
Arthas perfcounter 命令教程 (#1352)
* add perfcounter command scenario. #847 Signed-off-by: hollowman6 <hollowman186@vip.qq.com> * switch to use arthas-demo Signed-off-by: hollowman6 <hollowman186@vip.qq.com>pull/1364/head
parent
ed921432b3
commit
0da415f0ce
@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
|
||||
|
||||
下载`arthas-demo.jar`,再用`java -jar`命令启动:
|
||||
|
||||
`wget https://alibaba.github.io/arthas/arthas-demo.jar
|
||||
java -jar arthas-demo.jar`{{execute T1}}
|
||||
|
||||
`arthas-demo`是一个很简单的程序,它随机生成整数,再执行因式分解,把结果打印出来。如果生成的随机数是负数,则会打印提示信息。
|
@ -0,0 +1,35 @@
|
||||
{
|
||||
"title": "Arthas perfcounter命令",
|
||||
"description": "Arthas perfcounter命令",
|
||||
"difficulty": "精通者",
|
||||
"time": "10-20 分钟",
|
||||
"details": {
|
||||
"steps": [
|
||||
{
|
||||
"title": "Arthas demo",
|
||||
"text": "arthas-demo.md"
|
||||
},
|
||||
{
|
||||
"title": "启动arthas-boot",
|
||||
"text": "arthas-boot.md"
|
||||
},
|
||||
{
|
||||
"title": "perfcounter命令",
|
||||
"text": "perfcounter.md"
|
||||
}
|
||||
],
|
||||
"intro": {
|
||||
"text": "intro.md"
|
||||
},
|
||||
"finish": {
|
||||
"text": "finish.md"
|
||||
}
|
||||
},
|
||||
"environment": {
|
||||
"uilayout": "terminal"
|
||||
},
|
||||
"backend": {
|
||||
"imageid": "java",
|
||||
"environmentsprotocol": "http"
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Download `arthas-demo.jar` and start with the `java -jar` command:
|
||||
|
||||
`wget https://alibaba.github.io/arthas/arthas-demo.jar
|
||||
java -jar arthas-demo.jar`{{execute T1}}
|
||||
|
||||
`arthas-demo` is a very simple program that randomly generates integers, performs factorization, and prints the results.
|
||||
If the generated random number is negative, a error message will be printed.
|
@ -0,0 +1,8 @@
|
||||
|
||||
The `perfcounter Tutorial` demonstrates the usage of perfcounter. If you have more tips or questions, please feel free to ask in Issue.
|
||||
|
||||
* Issues: https://github.com/alibaba/arthas/issues
|
||||
* Documentation: https://alibaba.github.io/arthas
|
||||
|
||||
|
||||
If you are using Arthas, please let us know. Your use is very important to us: [View](https://github.com/alibaba/arthas/issues/111)
|
@ -0,0 +1,35 @@
|
||||
{
|
||||
"title": "Arthas perfcounter Command",
|
||||
"description": "Arthas perfcounter Command",
|
||||
"difficulty": "master",
|
||||
"time": "10-20 minutes",
|
||||
"details": {
|
||||
"steps": [
|
||||
{
|
||||
"title": "Arthas demo",
|
||||
"text": "arthas-demo.md"
|
||||
},
|
||||
{
|
||||
"title": "Start arthas-boot",
|
||||
"text": "arthas-boot.md"
|
||||
},
|
||||
{
|
||||
"title": "perfcounter Command",
|
||||
"text": "perfcounter.md"
|
||||
}
|
||||
],
|
||||
"intro": {
|
||||
"text": "intro.md"
|
||||
},
|
||||
"finish": {
|
||||
"text": "finish.md"
|
||||
}
|
||||
},
|
||||
"environment": {
|
||||
"uilayout": "terminal"
|
||||
},
|
||||
"backend": {
|
||||
"imageid": "java",
|
||||
"environmentsprotocol": "http"
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
|
||||
Check the current JVM Perf Counter information.
|
||||
|
||||
`perfcounter -h`{{execute T2}}
|
||||
|
||||
```bash
|
||||
USAGE:
|
||||
perfcounter [-d] [-h]
|
||||
|
||||
SUMMARY:
|
||||
Display the perf counter infornation.
|
||||
|
||||
Examples:
|
||||
perfcounter
|
||||
perfcounter -d
|
||||
|
||||
WIKI:
|
||||
https://alibaba.github.io/arthas/perfcounter
|
||||
|
||||
OPTIONS:
|
||||
-d, --details print all perf counter details
|
||||
-h, --help this help
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
`perfcounter`{{execute T2}}
|
||||
|
||||
```bash
|
||||
$ perfcounter
|
||||
java.ci.totalTime 2325637411
|
||||
java.cls.loadedClasses 3403
|
||||
java.cls.sharedLoadedClasses 0
|
||||
java.cls.sharedUnloadedClasses 0
|
||||
java.cls.unloadedClasses 0
|
||||
java.property.java.version 11.0.4
|
||||
java.property.java.vm.info mixed mode
|
||||
java.property.java.vm.name OpenJDK 64-Bit Server VM
|
||||
```
|
||||
|
||||
Print more information with the `-d` option:
|
||||
|
||||
`perfcounter -d`{{execute T2}}
|
||||
|
||||
```bash
|
||||
$ perfcounter -d
|
||||
Name Variability Units Value
|
||||
---------------------------------------------------------------------------------
|
||||
java.ci.totalTime Monotonic Ticks 3242526906
|
||||
java.cls.loadedClasses Monotonic Events 3404
|
||||
java.cls.sharedLoadedClasses Monotonic Events 0
|
||||
java.cls.sharedUnloadedClasses Monotonic Events 0
|
||||
java.cls.unloadedClasses Monotonic Events 0
|
||||
```
|
||||
|
||||
## PS: for JVM above JDK9
|
||||
|
||||
If the information is not printed, when the application starts, add the following parameters:
|
||||
|
||||
`--add-opens java.base/jdk.internal.perf=ALL-UNNAMED --add-exports java.base/jdk.internal.perf=ALL-UNNAMED`
|
Loading…
Reference in New Issue