PrintGCApplicationStoppedTime

后端 未结 1 380
我在风中等你
我在风中等你 2021-01-15 03:37

I have JVM option -XX:+PrintGCApplicationStoppedTime which prints real \"GC stop the world time\".

Example:

  • Total time for which application threads we
相关标签:
1条回答
  • 2021-01-15 03:55

    Please note that PrintGCApplicationStoppedTime prints safepoint time rather than GC time.
    See this answer for details.

    You can get cumulative time of safepoints through JDK-specific (i.e. unsupported) MXBean. This value is equal to the sum of all numbers printed in Total time for which application threads were stopped messages.

    sun.management.HotspotRuntimeMBean runtime =
            sun.management.ManagementFactoryHelper.getHotspotRuntimeMBean();
    
    System.out.println("Safepoint time:  " + runtime.getTotalSafepointTime() + " ms");
    System.out.println("Safepoint count: " + runtime.getSafepointCount());
    
    0 讨论(0)
提交回复
热议问题