src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapSummary.java
changeset 52925 9c18c9d839d3
parent 51498 9a5200b84046
child 53517 20ba6a7f897a
equal deleted inserted replaced
52924:420ff459906f 52925:9c18c9d839d3
    27 import java.util.*;
    27 import java.util.*;
    28 import sun.jvm.hotspot.gc.epsilon.*;
    28 import sun.jvm.hotspot.gc.epsilon.*;
    29 import sun.jvm.hotspot.gc.g1.*;
    29 import sun.jvm.hotspot.gc.g1.*;
    30 import sun.jvm.hotspot.gc.parallel.*;
    30 import sun.jvm.hotspot.gc.parallel.*;
    31 import sun.jvm.hotspot.gc.serial.*;
    31 import sun.jvm.hotspot.gc.serial.*;
       
    32 import sun.jvm.hotspot.gc.shenandoah.*;
    32 import sun.jvm.hotspot.gc.shared.*;
    33 import sun.jvm.hotspot.gc.shared.*;
    33 import sun.jvm.hotspot.gc.z.*;
    34 import sun.jvm.hotspot.gc.z.*;
    34 import sun.jvm.hotspot.debugger.JVMDebugger;
    35 import sun.jvm.hotspot.debugger.JVMDebugger;
    35 import sun.jvm.hotspot.memory.*;
    36 import sun.jvm.hotspot.memory.*;
    36 import sun.jvm.hotspot.oops.*;
    37 import sun.jvm.hotspot.oops.*;
    81       printValue("NewRatio                 = ", getFlagValue("NewRatio", flagMap));
    82       printValue("NewRatio                 = ", getFlagValue("NewRatio", flagMap));
    82       printValue("SurvivorRatio            = ", getFlagValue("SurvivorRatio", flagMap));
    83       printValue("SurvivorRatio            = ", getFlagValue("SurvivorRatio", flagMap));
    83       printValMB("MetaspaceSize            = ", getFlagValue("MetaspaceSize", flagMap));
    84       printValMB("MetaspaceSize            = ", getFlagValue("MetaspaceSize", flagMap));
    84       printValMB("CompressedClassSpaceSize = ", getFlagValue("CompressedClassSpaceSize", flagMap));
    85       printValMB("CompressedClassSpaceSize = ", getFlagValue("CompressedClassSpaceSize", flagMap));
    85       printValMB("MaxMetaspaceSize         = ", getFlagValue("MaxMetaspaceSize", flagMap));
    86       printValMB("MaxMetaspaceSize         = ", getFlagValue("MaxMetaspaceSize", flagMap));
    86       printValMB("G1HeapRegionSize         = ", HeapRegion.grainBytes());
    87       if (heap instanceof ShenandoahHeap) {
       
    88          printValMB("ShenandoahRegionSize     = ", ShenandoahHeapRegion.regionSizeBytes());
       
    89       } else {
       
    90          printValMB("G1HeapRegionSize         = ", HeapRegion.grainBytes());
       
    91       }
    87 
    92 
    88       System.out.println();
    93       System.out.println();
    89       System.out.println("Heap Usage:");
    94       System.out.println("Heap Usage:");
    90 
    95 
    91       if (heap instanceof GenCollectedHeap) {
    96       if (heap instanceof GenCollectedHeap) {
   124          System.out.println("PS Old Generation");
   129          System.out.println("PS Old Generation");
   125          printValMB("capacity = ", oldGen.capacity());
   130          printValMB("capacity = ", oldGen.capacity());
   126          printValMB("used     = ", oldGen.used());
   131          printValMB("used     = ", oldGen.used());
   127          printValMB("free     = ", oldFree);
   132          printValMB("free     = ", oldFree);
   128          System.out.println(alignment + (double)oldGen.used() * 100.0 / oldGen.capacity() + "% used");
   133          System.out.println(alignment + (double)oldGen.used() * 100.0 / oldGen.capacity() + "% used");
       
   134       } else if (heap instanceof ShenandoahHeap) {
       
   135          ShenandoahHeap sh = (ShenandoahHeap) heap;
       
   136          long num_regions = sh.numOfRegions();
       
   137          System.out.println("Shenandoah Heap:");
       
   138          System.out.println("   regions   = " + num_regions);
       
   139          printValMB("capacity  = ", num_regions * ShenandoahHeapRegion.regionSizeBytes());
       
   140          printValMB("used      = ", sh.used());
       
   141          printValMB("committed = ", sh.committed());
   129       } else if (heap instanceof EpsilonHeap) {
   142       } else if (heap instanceof EpsilonHeap) {
   130          EpsilonHeap eh = (EpsilonHeap) heap;
   143          EpsilonHeap eh = (EpsilonHeap) heap;
   131          printSpace(eh.space());
   144          printSpace(eh.space());
   132       } else if (heap instanceof ZCollectedHeap) {
   145       } else if (heap instanceof ZCollectedHeap) {
   133          ZCollectedHeap zheap = (ZCollectedHeap) heap;
   146          ZCollectedHeap zheap = (ZCollectedHeap) heap;
   176        }
   189        }
   177 
   190 
   178        l = getFlagValue("UseZGC", flagMap);
   191        l = getFlagValue("UseZGC", flagMap);
   179        if (l == 1L) {
   192        if (l == 1L) {
   180            System.out.print("ZGC ");
   193            System.out.print("ZGC ");
       
   194            l = getFlagValue("ParallelGCThreads", flagMap);
       
   195            System.out.println("with " + l + " thread(s)");
       
   196            return;
       
   197        }
       
   198 
       
   199        l = getFlagValue("UseShenandoahGC", flagMap);
       
   200        if (l == 1L) {
       
   201            System.out.print("Shenandoah GC ");
   181            l = getFlagValue("ParallelGCThreads", flagMap);
   202            l = getFlagValue("ParallelGCThreads", flagMap);
   182            System.out.println("with " + l + " thread(s)");
   203            System.out.println("with " + l + " thread(s)");
   183            return;
   204            return;
   184        }
   205        }
   185 
   206