Rate This Document
Findability
Accuracy
Completeness
Readability

Example

Monitoring Mode

1
devkit diag jvm-jitter -a monitor -e jit.deoptimization -c /home/DevKit-CLI-xx.xx.xx-Linux-Kunpeng/diag/config/kunpeng_devkit.cfg -p 1179

The -a monitor parameter specifies the monitoring mode, the -e jit.deoptimization parameter specifies de-optimization event monitoring, the -c parameter specifies the configuration file path, and the -p 1179 parameter specifies the ID of the Java process to be monitored.

Command output:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
17:27:28.597 [main] DEBUG com.huawei.kunpeng.devkit.odin.cli.config.JvmCliAppConfig - The cli cmd is -a:monitor:-e:jit.deoptimization:-c:/home/DevKit-CLI-xx.xx.xx-Linux-Kunpeng/diag/config/kunpeng_devkit.cfg:-p:1179:
17:27:28.961 [jvm-diagnosis-guardian-common-thread-1] INFO com.huawei.kunpeng.devkit.odin.cli.CliWorker - Success to build unixSocket connect
17:27:28.964 [jvm-diagnosis-guardian-common-thread-1] DEBUG com.huawei.kunpeng.devkit.odin.cli.CliWorker - begin jvm diagnosis monitor is called
17:27:28.964 [jvm-diagnosis-profiler-wireIo-thread-1] DEBUG com.huawei.kunpeng.devkit.odin.profiler.wire.WireIo - start receiving message. type : JvmDiagnosisResp
17:27:29.000 [jvm-diagnosis-profiler-wireIo-thread-1] INFO com.huawei.kunpeng.devkit.odin.cli.CliWorker - other type: CPU_JDBC_METHOD
17:27:30.062 [jvm-diagnosis-guardian-common-thread-1] DEBUG com.huawei.kunpeng.devkit.odin.profiler.wire.WireIo - sending message : type: JVM_JIT_MONITOR
17:27:30.066 [jvm-diagnosis-guardian-common-thread-1] DEBUG com.huawei.kunpeng.devkit.odin.profiler.wire.WireIo - message is sent
17:27:31.779 [jvm-diagnosis-profiler-wireIo-thread-1] INFO com.huawei.kunpeng.devkit.odin.cli.CliWorker - JVM_JIT_MONITOR, deoptimizationRatio= 0.0, startTime=2025/02/22 PM 05:27:31.751, compileCount=2353, deoptimizationCount=140
17:27:32.752 [jvm-diagnosis-profiler-wireIo-thread-1] INFO com.huawei.kunpeng.devkit.odin.cli.CliWorker - JVM_JIT_MONITOR, deoptimizationRatio= 0.0, startTime=2025/02/22 PM 05:27:31.851, compileCount=2384, deoptimizationCount=140
...
...
...

Analysis Mode

1
devkit diag jvm-jitter -a report -e jit.deoptimization -f /home/test/JIT_20250222_141519.jfr -o /home/report

The -a report parameter specifies the analysis mode, the -e jit.deoptimization parameter specifies de-optimization analysis, the -f parameter specifies the path to the JFR file to be analyzed, and the -o /home/report parameter specifies the path to the generated flame graph file.

Command output:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
17:07:13.607 [main] DEBUG com.huawei.kunpeng.devkit.odin.cli.config.JvmCliAppConfig - The cli cmd is -a:report:-e:jit.deoptimization:-f:/home/test/JIT_20250222_141519.jfr:
-----------------------------------------------------------
Reason                              Deoptimization methods
predicate                           1
unstable_if                         2
bimorphic_or_optimized_type_check   8
class_check                         4
------------------------------------------------------------
Action                              Deoptimization methods
reinterpret                         2
maybe_recompile                     13
------------------------------------------------------------
Method                                     Reason          Action            Instruction       Line No.  Compiler  StartTime
org.json.JSONObject.testValidity(Object)   class_check     maybe_recompile   checkcast         2608      c2        2025/02/22 PM 02:14:57.020
org.json.JSONObject.testValidity(Object)   class_check     maybe_recompile   checkcast         2608      c2        2025/02/22 PM 02:14:57.320
org.json.JSONObject.testValidity(Object)   class_check     maybe_recompile   checkcast         2608      c2        2025/02/22 PM 02:14:57.620
java.lang.StringLatin1.canEncode(int)      unstable_if     reinterpret       ifne              54        c2        2025/02/22 PM 02:15:18.963
java.lang.CharacterData.of(int)            unstable_if     reinterpret       ifne              72        c2        2025/02/22 PM 02:15:19.264
...
...
...
17:07:14,786 [main] c.h.k.d.o.cli.report.JfrToFlameGraph: The generated flame graph is: /home/report/FlameGraph_JIT_20250222_141519_20250222170713.html
Table 1 Parameters in a report file

Parameter

Description

Method

Name of the method that triggers de-optimization.

Reason

Cause of triggering de-optimization, for example:

  • predicate: The method inlining guard condition fails.
  • unstable_if: Branch prediction fails.
  • bimorphic_or_optimized_type_check: The number of polymorphic calls exceeds the threshold or the aggressive optimization fails.
  • class_check: Class type check fails.

Action

Operation performed by the JVM for de-optimization, for example:

  • maybe_recompile: triggers method recompilation (the compiler may be replaced).
  • invalidate: invalidates the currently compiled code and rolls back to the interpreter mode.
  • reinterpret: re-parses the method invocation target.

Instruction

Bytecode instruction that triggers de-optimization.

Line No.

Line number of the Java source code that triggers de-optimization.

Compilers

Compiler types that involve de-optimization, for example:

  • C1 (Client Compiler): quick compilation and slight optimization.
  • C2 (Server Compiler): In-depth optimization, suitable for long-term code running.
Figure 1 JIT flame graph