Java VM Option (계속)

VM Options을 쓸일은 많지 않지만, 기록을 남긴다.

VM Options은 Case Sensitivey 하기 때문에 대소문자에 주의 해야 한다.

1. PrintCompilation

-XX:+PrintCompilation

XX : Extention

+/- : on or off

첫번째 블럭 : VM 시작 후 밀리세컨드 타임

두번째 블럭 : 컴파일된 블럭의 order 순서

gist.github.com/chrisvest/2932907

% On stack replacement compile type:
* With flag: This CompileTask is an OSR compilation task
* Without: This CompileTask is a standard compilation task
s Synchronized method * With flag: The method to compile is declared as synchronized
* Without: The method to compile is not declared as synchronized
! Method has exception handlers * With flag: The method to compile has one or more exception handlers
* Without: The method to compile doesn't have any exception handlers
b Blocking compilation * With flag: Application thread is blocked by this CompileTask
* Without: This CompileTask is executed by a background compiler thread
n Native wrapper * With flag: The method to compile is native (not actually compiling the method, but instead generating a native wrapper)
* Without: The method to compile is a Java method

3번째 블럭 : 0~4 사이 (컴파일 Level로 Prioroty 표시)

컴파일러는 C1, C2가 있고 Level 4만 C2에 에서 처리 한다.

->  Level 4 : code Cache에 담길 가능성이 더 높다.

"WM warning: CodeCache is full"이 발생하면 최적화 상태로 프로그램이 돌지 않을 가능성이 높다

     46    1       3       java.lang.StringLatin1::hashCode (42 bytes)
     46    2       3       java.lang.String::isLatin1 (19 bytes)
     48    3       3       java.lang.String::charAt (25 bytes)
     48    7     n 0       jdk.internal.misc.Unsafe::getObjectVolatile (native)   
     48    4       3       java.lang.StringLatin1::charAt (28 bytes)
     48    5       3       java.util.concurrent.ConcurrentHashMap::tabAt (22 bytes)
     48    6       3       jdk.internal.misc.Unsafe::getObjectAcquire (7 bytes)
     49    8       3       java.lang.Object::<init> (1 bytes)
     49    9       3       java.lang.StringLatin1::canEncode (13 bytes)
     50   10       3       java.lang.String::coder (15 bytes)
     53   11       3       java.lang.String::hashCode (49 bytes)
     53   12       3       java.lang.Math::floorMod (10 bytes)

 

2. XX:+UnlockDiagnosticVMOptions

 

3. XX:+LogicCompilation

4. XX:+PrintCodeCache

코드 캐쉬 사이즈를 보여준다. Max 코드캐쉬의 사이즈는 자바 버전에 따라서 다르다.

CodeHeap 'non-profiled nmethods': size=119168Kb used=62Kb max_used=62Kb free=119105Kb
 bounds [0x000001ce428a0000, 0x000001ce42b10000, 0x000001ce49d00000]
CodeHeap 'profiled nmethods': size=119168Kb used=294Kb max_used=294Kb free=118874Kb
 bounds [0x000001ce3b440000, 0x000001ce3b6b0000, 0x000001ce428a0000]
CodeHeap 'non-nmethods': size=7424Kb used=1631Kb max_used=1642Kb free=5792Kb
 bounds [0x000001ce3ad00000, 0x000001ce3af70000, 0x000001ce3b440000]
 total_blobs=631 nmethods=212 adapters=263
 compilation: enabled
              stopped_count=0, restarted_count=0
 full_count=0

 

5. -XX:ReservedCodeCacheSize=28m

+,_ flag는 없으며 들어갈 수 있는 명령어는 아래와 같다. m은 Mega byte이다.

InitialCodeCacheSize (초기값), ReservedCodeCacheSize(최대값), CodeCacheExpasionSize(확장 사이즈, 초기 -> 최대)

 

6. JVM에서 만들어진 프로세스 모니터링

Windows 기준 : C:\Users\<<Username>>\AppData\Local\Temp\hsperfdata_home

여기서 나온 숫자는 각 프로그램의 Process Number임

7. JVM 프로세스 모니터링

<<JDK_HOME>>/bin/jconsole.exe

코드캐쉬 사이즈 모니터링

 

728x90
반응형

'잡동사니' 카테고리의 다른 글

apt-cyg cygwin에 install  (0) 2021.05.11
Rxjava 정리  (0) 2021.04.13
프로그래머스 vs code 체험  (0) 2020.09.26