src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/PrintRegionClosure.java
author jgeorge
Tue, 20 Mar 2018 11:24:32 +0530
changeset 49463 ccb003941743
permissions -rw-r--r--
8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC Summary: Provide an improved heap summary for G1GC with parameters like 'capacity', 'used', 'free', etc with the 'universe' command, and introduce a new command 'g1regiondetails' to display the individual region details. Reviewed-by: sjohanss, minqi
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49463
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
     1
/*
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
     4
 *
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
     7
 * published by the Free Software Foundation.
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
     8
 *
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    13
 * accompanied this code).
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    14
 *
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    18
 *
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    21
 * questions.
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    22
 *
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    23
 */
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    24
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    25
package sun.jvm.hotspot.gc.shared;
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    26
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    27
import java.io.PrintStream;
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    28
import sun.jvm.hotspot.gc.g1.HeapRegion;
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    29
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    30
public class PrintRegionClosure implements SpaceClosure {
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    31
  private PrintStream tty;
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    32
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    33
  public PrintRegionClosure(PrintStream tty) {
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    34
    this.tty = tty;
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    35
  }
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    36
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    37
  public void doSpace(Space hr) {
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    38
    ((HeapRegion)hr).printOn(tty);
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    39
  }
ccb003941743 8175312: SA: clhsdb: Provide an improved heap summary for 'universe' for G1GC
jgeorge
parents:
diff changeset
    40
}