src/hotspot/share/gc/g1/g1HeapTransition.cpp
author sangheki
Wed, 13 Nov 2019 10:51:41 -0800
changeset 59062 6530de931b8e
parent 55576 4d193e40e7af
permissions -rw-r--r--
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3) Reviewed-by: kbarrett, sjohanss, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
     1
/*
53985
0da5c17f5e43 8219747: Remove g1_ prefix to g1_remset and g1_policy members in G1CollectedHeap
tschatzl
parents: 52975
diff changeset
     2
 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
     4
 *
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
     7
 * published by the Free Software Foundation.
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
     8
 *
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    13
 * accompanied this code).
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    14
 *
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    18
 *
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    21
 * questions.
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    22
 *
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    23
 */
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    24
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    25
#include "precompiled.hpp"
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    26
#include "gc/g1/g1CollectedHeap.hpp"
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    27
#include "gc/g1/g1HeapTransition.hpp"
37985
539c597ee0fa 8154154: Separate G1 specific policy code from the CollectorPolicy class hierarchy
mgerdin
parents: 37099
diff changeset
    28
#include "gc/g1/g1Policy.hpp"
59062
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    29
#include "logging/logStream.hpp"
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    30
#include "memory/metaspace.hpp"
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    31
59062
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    32
G1HeapTransition::Data::Data(G1CollectedHeap* g1_heap) :
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    33
  _eden_length(g1_heap->eden_regions_count()),
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    34
  _survivor_length(g1_heap->survivor_regions_count()),
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    35
  _old_length(g1_heap->old_regions_count()),
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    36
  _archive_length(g1_heap->archive_regions_count()),
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    37
  _humongous_length(g1_heap->humongous_regions_count()),
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    38
  _eden_length_per_node(NULL),
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    39
  _survivor_length_per_node(NULL) {
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    40
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    41
  uint node_count = G1NUMA::numa()->num_active_nodes();
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    42
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    43
  if (node_count > 1) {
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    44
    LogTarget(Debug, gc, heap, numa) lt;
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    45
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    46
    if (lt.is_enabled()) {
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    47
      _eden_length_per_node = NEW_C_HEAP_ARRAY(uint, node_count, mtGC);
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    48
      _survivor_length_per_node = NEW_C_HEAP_ARRAY(uint, node_count, mtGC);
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    49
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    50
      for (uint i = 0; i < node_count; i++) {
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    51
        _eden_length_per_node[i] = g1_heap->eden_regions_count(i);
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    52
        _survivor_length_per_node[i] = g1_heap->survivor_regions_count(i);
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    53
      }
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    54
    }
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    55
  }
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    56
}
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    57
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    58
G1HeapTransition::Data::~Data() {
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    59
  FREE_C_HEAP_ARRAY(uint, _eden_length_per_node);
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
    60
  FREE_C_HEAP_ARRAY(uint, _survivor_length_per_node);
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    61
}
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    62
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    63
G1HeapTransition::G1HeapTransition(G1CollectedHeap* g1_heap) : _g1_heap(g1_heap), _before(g1_heap) { }
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    64
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    65
struct DetailedUsage : public StackObj {
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    66
  size_t _eden_used;
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    67
  size_t _survivor_used;
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    68
  size_t _old_used;
51494
1906adbef2dc 8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents: 49389
diff changeset
    69
  size_t _archive_used;
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    70
  size_t _humongous_used;
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    71
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    72
  size_t _eden_region_count;
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    73
  size_t _survivor_region_count;
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    74
  size_t _old_region_count;
51494
1906adbef2dc 8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents: 49389
diff changeset
    75
  size_t _archive_region_count;
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    76
  size_t _humongous_region_count;
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    77
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    78
  DetailedUsage() :
51494
1906adbef2dc 8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents: 49389
diff changeset
    79
    _eden_used(0), _survivor_used(0), _old_used(0), _archive_used(0), _humongous_used(0),
1906adbef2dc 8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents: 49389
diff changeset
    80
    _eden_region_count(0), _survivor_region_count(0), _old_region_count(0),
1906adbef2dc 8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents: 49389
diff changeset
    81
    _archive_region_count(0), _humongous_region_count(0) {}
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    82
};
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    83
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    84
class DetailedUsageClosure: public HeapRegionClosure {
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    85
public:
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    86
  DetailedUsage _usage;
48969
jwilhelm
parents: 48890
diff changeset
    87
  bool do_heap_region(HeapRegion* r) {
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    88
    if (r->is_old()) {
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    89
      _usage._old_used += r->used();
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    90
      _usage._old_region_count++;
51494
1906adbef2dc 8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents: 49389
diff changeset
    91
    } else if (r->is_archive()) {
1906adbef2dc 8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents: 49389
diff changeset
    92
      _usage._archive_used += r->used();
1906adbef2dc 8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents: 49389
diff changeset
    93
      _usage._archive_region_count++;
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    94
    } else if (r->is_survivor()) {
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    95
      _usage._survivor_used += r->used();
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    96
      _usage._survivor_region_count++;
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    97
    } else if (r->is_eden()) {
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    98
      _usage._eden_used += r->used();
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
    99
      _usage._eden_region_count++;
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   100
    } else if (r->is_humongous()) {
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   101
      _usage._humongous_used += r->used();
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   102
      _usage._humongous_region_count++;
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   103
    } else {
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   104
      assert(r->used() == 0, "Expected used to be 0 but it was " SIZE_FORMAT, r->used());
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   105
    }
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   106
    return false;
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   107
  }
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   108
};
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   109
59062
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   110
static void log_regions(const char* msg, size_t before_length, size_t after_length, size_t capacity,
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   111
                        uint* before_per_node_length, uint* after_per_node_length) {
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   112
  LogTarget(Info, gc, heap) lt;
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   113
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   114
  if (lt.is_enabled()) {
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   115
    LogStream ls(lt);
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   116
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   117
    ls.print("%s regions: " SIZE_FORMAT "->" SIZE_FORMAT "("  SIZE_FORMAT ")",
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   118
             msg, before_length, after_length, capacity);
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   119
    // Not NULL only if gc+heap+numa at Debug level is enabled.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   120
    if (before_per_node_length != NULL && after_per_node_length != NULL) {
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   121
      G1NUMA* numa = G1NUMA::numa();
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   122
      uint num_nodes = numa->num_active_nodes();
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   123
      const int* node_ids = numa->node_ids();
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   124
      ls.print(" (");
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   125
      for (uint i = 0; i < num_nodes; i++) {
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   126
        ls.print("%d: %u->%u", node_ids[i], before_per_node_length[i], after_per_node_length[i]);
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   127
        // Skip adding below if it is the last one.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   128
        if (i != num_nodes - 1) {
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   129
          ls.print(", ");
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   130
        }
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   131
      }
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   132
      ls.print(")");
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   133
    }
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   134
    ls.print_cr("");
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   135
  }
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   136
}
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   137
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   138
void G1HeapTransition::print() {
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   139
  Data after(_g1_heap);
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   140
53985
0da5c17f5e43 8219747: Remove g1_ prefix to g1_remset and g1_policy members in G1CollectedHeap
tschatzl
parents: 52975
diff changeset
   141
  size_t eden_capacity_length_after_gc = _g1_heap->policy()->young_list_target_length() - after._survivor_length;
0da5c17f5e43 8219747: Remove g1_ prefix to g1_remset and g1_policy members in G1CollectedHeap
tschatzl
parents: 52975
diff changeset
   142
  size_t survivor_capacity_length_before_gc = _g1_heap->policy()->max_survivor_regions();
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   143
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   144
  DetailedUsage usage;
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   145
  if (log_is_enabled(Trace, gc, heap)) {
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   146
    DetailedUsageClosure blk;
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   147
    _g1_heap->heap_region_iterate(&blk);
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   148
    usage = blk._usage;
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   149
    assert(usage._eden_region_count == 0, "Expected no eden regions, but got " SIZE_FORMAT, usage._eden_region_count);
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   150
    assert(usage._survivor_region_count == after._survivor_length, "Expected survivors to be " SIZE_FORMAT " but was " SIZE_FORMAT,
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   151
        after._survivor_length, usage._survivor_region_count);
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   152
    assert(usage._old_region_count == after._old_length, "Expected old to be " SIZE_FORMAT " but was " SIZE_FORMAT,
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   153
        after._old_length, usage._old_region_count);
51494
1906adbef2dc 8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents: 49389
diff changeset
   154
    assert(usage._archive_region_count == after._archive_length, "Expected archive to be " SIZE_FORMAT " but was " SIZE_FORMAT,
1906adbef2dc 8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents: 49389
diff changeset
   155
        after._archive_length, usage._archive_region_count);
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   156
    assert(usage._humongous_region_count == after._humongous_length, "Expected humongous to be " SIZE_FORMAT " but was " SIZE_FORMAT,
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   157
        after._humongous_length, usage._humongous_region_count);
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   158
  }
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   159
59062
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   160
  log_regions("Eden", _before._eden_length, after._eden_length, eden_capacity_length_after_gc,
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   161
              _before._eden_length_per_node, after._eden_length_per_node);
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   162
  log_trace(gc, heap)(" Used: 0K, Waste: 0K");
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   163
59062
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   164
  log_regions("Survivor", _before._survivor_length, after._survivor_length, survivor_capacity_length_before_gc,
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 55576
diff changeset
   165
              _before._survivor_length_per_node, after._survivor_length_per_node);
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   166
  log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K",
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   167
      usage._survivor_used / K, ((after._survivor_length * HeapRegion::GrainBytes) - usage._survivor_used) / K);
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   168
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   169
  log_info(gc, heap)("Old regions: " SIZE_FORMAT "->" SIZE_FORMAT,
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   170
                     _before._old_length, after._old_length);
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   171
  log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K",
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   172
      usage._old_used / K, ((after._old_length * HeapRegion::GrainBytes) - usage._old_used) / K);
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   173
51494
1906adbef2dc 8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents: 49389
diff changeset
   174
  log_info(gc, heap)("Archive regions: " SIZE_FORMAT "->" SIZE_FORMAT,
1906adbef2dc 8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents: 49389
diff changeset
   175
                     _before._archive_length, after._archive_length);
1906adbef2dc 8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents: 49389
diff changeset
   176
  log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K",
1906adbef2dc 8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents: 49389
diff changeset
   177
      usage._archive_used / K, ((after._archive_length * HeapRegion::GrainBytes) - usage._archive_used) / K);
1906adbef2dc 8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents: 49389
diff changeset
   178
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   179
  log_info(gc, heap)("Humongous regions: " SIZE_FORMAT "->" SIZE_FORMAT,
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   180
                     _before._humongous_length, after._humongous_length);
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   181
  log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K",
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   182
      usage._humongous_used / K, ((after._humongous_length * HeapRegion::GrainBytes) - usage._humongous_used) / K);
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   183
55576
4d193e40e7af 8223575: add subspace transitions to gc+metaspace=info log lines
tonyp
parents: 53985
diff changeset
   184
  MetaspaceUtils::print_metaspace_change(_before._meta_sizes);
35909
cf5f3c85e179 8148736: Let the G1 heap transition log regions instead of bytes
brutisso
parents:
diff changeset
   185
}