perfcounter
查看JVM的Perf Counter,一些性能相关的计量值
命令选项
命令选项 | 描述 |
---|---|
-d, --detail | 查看详情 |
-h, --help | 帮助 |
列描述说明
列名 | 说明 |
---|---|
Name | 计量名称 |
Value | 计量值 |
Variability | 计量类型 |
Units | 计量单位 |
Variability
参考sun.management.counter.Variability
- CONSTANT 常量值
- MONOTONIC 单调值
- VARIABLE 变量值
UNITS
参考sun.management.counter.Units
- NONE 无
- BYTES 字节数
- TICKS 时间
- EVENTS 事件次数
- STRING 字符串
- HERTZ 赫兹
Counter创建代码
java
LongBuffer longBuffer =
Perf.getPerf()
.createLong("your_counter_name", Variability.VARIABLE.intValue(), Units.EVENTS.intValue(), 110L)
.order(ByteOrder.nativeOrder())
.asLongBuffer();
longBuffer.put(0, longBuffer.get(0) + 1);
1
2
3
4
5
6
2
3
4
5
6
示例
bash
# 默认只列出名称和计量值
[arthas@10580]$ perfcounter
sun.ci.compilerThread.0.time 316
sun.ci.compilerThread.1.time 183
sun.ci.compilerThread.10.time 1274
sun.ci.compilerThread.11.time 1460
sun.ci.compilerThread.2.time 217
sun.ci.compilerThread.3.time 210
...
sun.rt._sync_SuccessfulSpins 0
sun.rt.interruptedBeforeIO 0
sun.rt.interruptedDuringIO 0
sun.rt.safepoints 541
sun.rt.threadInterruptSignaled 0
# 列出计量详情
[arthas@10580]$ perfcounter -d
java.ci.totalTime Monotonic Ticks 34929572
sun.ci.compilerThread.0.time Monotonic Ticks 316
sun.ci.compilerThread.1.time Monotonic Ticks 183
sun.ci.compilerThread.10.time Monotonic Ticks 1274
sun.ci.compilerThread.11.time Monotonic Ticks 1460
sun.ci.compilerThread.2.time Monotonic Ticks 217
sun.ci.compilerThread.3.time Monotonic Ticks 210
...
sun.rt._sync_SuccessfulSpins Monotonic Events 0
sun.rt.interruptedBeforeIO Monotonic Events 0
sun.rt.interruptedDuringIO Monotonic Events 0
sun.rt.safepoints Monotonic Events 541
sun.rt.threadInterruptSignaled Monotonic Events 0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29