Use PrintGCApplicationStoppedTime flag in java 9

My application uses the gc flag "PrintGCApplicationStoppedTime", but when I run it with Java 9 it has an error with the following error:

Unrecognized VM option 'PrintGCApplicationStoppedTime'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

This message indicates that the option is outdated, but is there any alternative for the information printed by its flag, or is this information no longer available?

+4
source share
2 answers

A little to know about there:

First of all, it’s good that here from @apangin sums up that it PrintGCApplicationStoppedTimeprints time spent inside safepoints .

, :

-XX:+PrintSafepointStatistics -XX:PrintSafepointStatisticsCount=1

-, Java 9 Unified GC logging JEP # 271, JVM JEP # 158

, -Xlog JVM. , ():

-Xlog[:option]
    option         :=  [<what>][:[<output>][:[<decorators>][:<output-options>]]]
                       'help'
                       'disable'
    what           :=  <selector>[,...]
    selector       :=  <tag-set>[*][=<level>]
    tag-set        :=  <tag>[+...]
                       'all'
    tag            :=  name of tag
    level          :=  trace
                       debug
                       info
                       warning
                       error
    output         :=  'stderr'
                       'stdout'
                       [file=]<filename>
    decorators     :=  <decorator>[,...]
                       'none'
    decorator      :=  time
                       uptime
                       timemillis
                       uptimemillis
                       timenanos
                       uptimenanos
                       pid
                       tid
                       level
                       tags
    output-options :=  <output_option>[,...]
    output-option  :=  filecount=<file count>
                       filesize=<file size in kb>
                       parameter=value

, :

  • -Xlog:gc=trace:file=gctrace.txt:uptimemillis,pids:filecount=5,filesize=1024
    
    • 'gc' 'trace' 5 1 'gctrace.txt' uptimemillis '' pid '
    • 'warning' to 'stderr'
  • -Xlog:gc+rt+compiler*=debug,meta*=warning,svc*=off
    
    • , "gc" "rt" "compiler" "trace" "stdout", "" "" "" 'svc'
    • 'warning' to 'stderr'
+3

. JDK 9, (-Xlog): http://jdk.java.net/9/release-notes#JDK-8145092 , PrintGCApplicationStoppedTime .

+1

Source: https://habr.com/ru/post/1684589/


All Articles