Recommended
PDF
PDF
使ってみよう!JDK Flight Recorder
PPTX
java.lang.OutOfMemoryError #渋谷java
PDF
Concurrent Mark-Sweep Garbage Collection #jjug_ccc
PPTX
Tomcatの実装から学ぶクラスローダリーク #渋谷Java
PPTX
PDF
より速く より運用しやすく 進化し続けるJVM(Java Developers Summit Online 2023 発表資料)
ODP
PDF
Javaコードが速く実⾏される秘密 - JITコンパイラ⼊⾨(JJUG CCC 2020 Fall講演資料)
PDF
PDF
Garbage First Garbage Collection (G1 GC) #jjug_ccc #ccc_cd6
PDF
OpenJDK トラブルシューティング #javacasual
PPTX
第六回渋谷Java Java8のJVM監視を考える
PDF
オススメのJavaログ管理手法 ~コンテナ編~(Open Source Conference 2022 Online/Spring 発表資料)
PPTX
Java11へのマイグレーションガイド ~Apache Hadoopの事例~
PDF
ClassLoader Leak Patterns
PPTX
PDF
PPTX
Redis勉強会資料(2015/06 update)
PDF
PDF
PPTX
PDF
PDF
PDF
実践!OpenTelemetry と OSS を使った Observability 基盤の構築(CloudNative Days Tokyo 2022 発...
PDF
PPTX
Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)
PDF
PPTX
Java トラブル解析支援ツール HeapStats のご紹介
PDF
More Related Content
PDF
PDF
使ってみよう!JDK Flight Recorder
PPTX
java.lang.OutOfMemoryError #渋谷java
PDF
Concurrent Mark-Sweep Garbage Collection #jjug_ccc
PPTX
Tomcatの実装から学ぶクラスローダリーク #渋谷Java
PPTX
PDF
より速く より運用しやすく 進化し続けるJVM(Java Developers Summit Online 2023 発表資料)
ODP
What's hot
PDF
Javaコードが速く実⾏される秘密 - JITコンパイラ⼊⾨(JJUG CCC 2020 Fall講演資料)
PDF
PDF
Garbage First Garbage Collection (G1 GC) #jjug_ccc #ccc_cd6
PDF
OpenJDK トラブルシューティング #javacasual
PPTX
第六回渋谷Java Java8のJVM監視を考える
PDF
オススメのJavaログ管理手法 ~コンテナ編~(Open Source Conference 2022 Online/Spring 発表資料)
PPTX
Java11へのマイグレーションガイド ~Apache Hadoopの事例~
PDF
ClassLoader Leak Patterns
PPTX
PDF
PPTX
Redis勉強会資料(2015/06 update)
PDF
PDF
PPTX
PDF
PDF
PDF
実践!OpenTelemetry と OSS を使った Observability 基盤の構築(CloudNative Days Tokyo 2022 発...
PDF
PPTX
Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)
PDF
Viewers also liked
PPTX
Java トラブル解析支援ツール HeapStats のご紹介
PDF
PDF
PPTX
Garbage First Garbage Collector (G1 GC) - Migration to, Expectations and Adva...
PPTX
第七回 渋谷Java - Apache Shiroを使ってみた
PPTX
Similar to Java 9で進化する診断ツール
PDF
PDF
Java SE 8におけるHotSpotの進化 [Java Day Tokyo 2014 C-2]
PPTX
Introduction to JIT Compiler in JVM
PDF
OpenJDK HotSpot C1Compiler Overview
PDF
Adaptive optimization of JIT compiler
PDF
JJUGナイトセミナー OpenJDK祭り「OpenJ9+OpenJDK」
PDF
PDF
Javaトラブルに備えよう #jjug_ccc #ccc_h2
PDF
HeapStats: Introduction and Technical Preview
ODP
PDF
Debug Hacks at Security and Programming camp 2011
PDF
Programming camp 2010 debug hacks
KEY
関ジャバ JavaOne Tokyo 2012報告会
PPT
PDF
JavaOne 2015 JDK Update (Jigsaw) #j1jp
PDF
PPTX
Jjug night seminar201208_lt_cxxからjvm起動
PDF
JavaOne 2016 Java SE Feedback #jjug #j1jp
PDF
Oracle code one 2018 報告会概要
PDF
Javaはどのように動くのか~スライドでわかるJVMの仕組み
More from Yasumasa Suenaga
PDF
PPTX
Panamaを先取り!? JVMCIでJITと遊ぶ
PPTX
PPTX
PPTX
HeapStatsのデモ (Java The Night)
PPTX
PPTX
もしも… Javaでヘテロジニアスコアが使えたら…
Java 9で進化する診断ツール 1. 2. 3. 4. 5. 7. 8. 9. 10. コマンド 内容
VM.log ログ出力設定とローテーションの実行
VM.print_touched_methods 実行されたメソッドの一覧表示
VM.classloader_stats クラスローダに関する情報の表示
VM.stringtable StringTable(String#intern()した文字列や解決した
クラス名が入っているテーブル)の概要表示、ダンプ
VM.symboltable SymbolTable(メソッド名等)の概要表示、ダンプ
VM.class_hierarchy Javaヒープ中のクラス階層構造の表示
VM.info javaプロセスの詳細情報、およびマシン情報の表示
VM.dynlibs ロードされている共有ライブラリの出力
VM.set_flag フラグ(-XXオプション)の変更
VMドメイン
11. 12. 14. 15. 16. $ jcmd 1234 VM.log output="file=gc.log"
output_options="filecount=5,filesize=10m"
what="gc=debug"
decorators="time,level"
オプション名 内容
output 出力先
”#<数字>”を指定すると既存のoutputに対する変更を意味する
output_options 出力オプション
what タグやログレベルの設定
decorators ログデコレーションの設定
17. 18. $ jcmd 1234 VM.log list
1234:
Available log levels: off, trace, debug, info, warning, error
Available log decorators: time (t), uptime (u), timemillis (tm), uptimemillis (um), timenanos (tn), uptimenanos
(un), hostname (hn), pid (p), tid (ti), level (l), tags (tg)
Available log tags: add, age, alloc, arguments, annotation, barrier, biasedlocking, bot, breakpoint, census,
class, classhisto, cleanup, compaction, constraints, constantpool, coops, cpu, cset, data, defaultmethods, dump,
ergo, exceptions, exit, freelist, gc, heap, humongous, ihop, iklass, init, itables, jni, jvmti, liveness, load,
loader, logging, mark, marking, methodcomparator, metadata, metaspace, mmu, modules, monitorinflation,
monitormismatch, nmethod, normalize, objecttagging, obsolete, oopmap, os, pagesize, path, phases, plab, promotion,
preorder, protectiondomain, ref, redefine, refine, region, remset, purge, resolve, safepoint, scavenge, scrub,
stacktrace, start, startuptime, state, stats, stringdedup, stringtable, stackmap, subclass, survivor, sweep, task,
thread, tlab, time, timer, update, unload, verification, verify, vmoperation, vtables, workgang
Described tag combinations:
logging: Logging for the log framework itself
Log output configuration:
#0: stdout all=warning uptime,level,tags
#1: stderr all=off uptime,level,tags
#2: gc.log gc=debug filecount=5,filesize=20M level,tags
JDK-8153074
UL: Show output option in VM.log jcmd
19. 20. 21. $ jcmd 1234 VM.info
1234:
#
# JRE version: Java(TM) SE Runtime Environment (9.0+119) (build 9-ea+119)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (9-ea+119, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
--------------- S U M M A R Y ------------
Command Line: LongSleep
Host: Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz, 2 cores, 1G, Fedora release 23 (Twenty Three)
Time: Mon May 23 20:32:22 2016 JST elapsed time: 16 seconds (0d 0h 0m 16s)
--------------- P R O C E S S ---------------
Heap address: 0x00000000e0e00000, size: 498 MB, Compressed Oops mode: 32-bit
Narrow klass base: 0x0000000000000000, Narrow klass shift: 3
Compressed class space size: 1073741824 Address: 0x0000000100000000
:
22. 23. •
•
$ jcmd 1234 VM.flags -all | grep -E 'manageable|product_rw'
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 = 70 {manageable}
uintx MinHeapFreeRatio = 40 {manageable}
bool PrintClassHistogram = false {manageable}
bool PrintConcurrentLocks = false {manageable}
24. •
$ jcmd 1234 VM.set_flag HeapDumpOnOutOfMemoryError true
1234:
Command executed successfully
$ jcmd 1234 VM.flags
1234:
-XX:CICompilerCount=2 -XX:ConcGCThreads=1 -XX:G1HeapRegionSize=1048576
-XX:+HeapDumpOnOutOfMemoryError -XX:InitialHeapSize=33554432 -XX:MarkStackSize=4194304
-XX:MaxHeapSize=522190848 -XX:MaxNewSize=312475648 -XX:MinHeapDeltaBytes=1048576
-XX:NonNMethodCodeHeapSize=5824844 -XX:NonProfiledCodeHeapSize=122916698
-XX:ProfiledCodeHeapSize=122916698 -XX:ReservedCodeCacheSize=251658240
-XX:+SegmentedCodeCache -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC
JDK-8155936
Boolean value should be set 1/0 or true/false via
VM.set_flag jcmd
25. 26. 27. 28. $ jcmd 1234 Compiler.directives_add compiler-directive.json
1234:
1 compiler directives added
29. •
$ jcmd 1234 Compiler.directives_print
1234:
Directive:
matching: *String.hashCode
c1 directives:
inline: -
Enable:false Exclude:false BreakAtExecute:false BreakAtCompile:false Log:false PrintAssembly:false PrintInlining:false PrintNMethods:false
BackgroundCompilation:true ReplayInline:false DumpReplay:false DumpInline:false CompilerDirectivesIgnoreCompileCommands:false DisableIntrinsic:
BlockLayoutByFrequency:true PrintOptoAssembly:false PrintIntrinsics:false TraceOptoPipelining:false TraceOptoOutput:false TraceSpilling:false
Vectorize:false VectorizeDebug:false CloneMapDebug:false DoReserveCopyInSuperWordDebug:false IGVPrintLevel:0 MaxNodeLimit:80000
c2 directives:
inline: -
Enable:true Exclude:true BreakAtExecute:false BreakAtCompile:false Log:false PrintAssembly:false PrintInlining:false PrintNMethods:false
BackgroundCompilation:true ReplayInline:false DumpReplay:false DumpInline:false CompilerDirectivesIgnoreCompileCommands:false DisableIntrinsic:
BlockLayoutByFrequency:true PrintOptoAssembly:false PrintIntrinsics:false TraceOptoPipelining:false TraceOptoOutput:false TraceSpilling:false
Vectorize:false VectorizeDebug:false CloneMapDebug:false DoReserveCopyInSuperWordDebug:false IGVPrintLevel:0 MaxNodeLimit:80000
Enable :ディレクティブの明示的設定
Exclude :JIT除外設定
30. 31. •
$ jcmd 1234 Compiler.codelist
1234:
53 4 java.lang.String.hashCode()I [0x00007fd2cd776090, 0x00007fd2cd776200 - 0x00007fd2cd776398]
コンパイル
ID
コンパイルレベル
(Tiered Compilation)
メソッド名
nmethod
開始アドレス
コード
開始アドレス
コード
終了アドレス
32. 33. 34. 35. 36. 37. 38. 39. 40. •
•
•
•
•
$ jcmd 1234 GC.heap_info
1234:
garbage-first heap total 32768K, used 1024K [0x00000000e0e00000, 0x00000000e0f00100, 0x0000000100000000)
region size 1024K, 2 young (2048K), 0 survivors (0K)
Metaspace used 3332K, capacity 4486K, committed 4864K, reserved 1056768K
class space used 328K, capacity 386K, committed 512K, reserved 1048576K
42. 43. 44. •
"Attach Listener" #12 daemon prio=9 os_prio=0 tid=0x00007f3224001000 nid=0xb8f7 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
45. 46. 48. 49. • S A
•
• Java 9からは各種ツールでSAが使えなくなりました!
•
• OpenJDKのdebuginfoパッケージ必須
•
•
•
50. 51. 52. 53. 54. 55. •
(gdb) x/g ((G1CollectedHeap *)Universe::_collectedHeap)->_g1mm->_full_collection_counters->_time ->_valuep
0x7f8c6884b960: 15535194
例:Full GCの累計実行時間を出してみる(jstatのFGCT相当)
15535194÷1000000000≒0.015 (sec)
56. 57. •
$ $JAVA_HOME/bin/jhsdb jsnap --exe $JAVA_HOME/bin/java --core core.6937 --all |
grep -a -e sun.gc.collector.1.time -e sun.os.hrt.frequency
sun.gc.collector.1.time=15535194 tick(s)
sun.os.hrt.frequency=1000000000 Hz
15535194÷1000000000≒0.015 (sec)
この実現のためにJDK-8151815ガンバってます!
58. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. Fedora23 x64の場合
$ dnf download --source binutils
$ rpm -ivh <binutils>
$ cd ~/rpmbuild/SPECS
$ rpmbuild -bp binutils.spec
$ cd <OpenJDK src>/hotspot/src/share/tools/hsdis
$ make BINUTILS=~/rpmbuild/BUILD/<binutils> ARCH=amd64
$ ls build/linux-amd64/hsdis-amd64.so
build/linux-amd64/hsdis-amd64.so
binutilsの
SRPM取得
SRPM展開
hsdisのビルド
hsdis本体
70. 72. 73.