< prev index next >
src/hotspot/share/gc/g1/g1HeapTransition.cpp
Print this page
rev 56834 : imported patch 8220312.stat.2
rev 56835 : imported patch 8220312.stat.3
@@ -24,19 +24,42 @@
#include "precompiled.hpp"
#include "gc/g1/g1CollectedHeap.hpp"
#include "gc/g1/g1HeapTransition.hpp"
#include "gc/g1/g1Policy.hpp"
-#include "logging/log.hpp"
+#include "logging/logStream.hpp"
#include "memory/metaspace.hpp"
-G1HeapTransition::Data::Data(G1CollectedHeap* g1_heap) {
- _eden_length = g1_heap->eden_regions_count();
- _survivor_length = g1_heap->survivor_regions_count();
- _old_length = g1_heap->old_regions_count();
- _archive_length = g1_heap->archive_regions_count();
- _humongous_length = g1_heap->humongous_regions_count();
+G1HeapTransition::Data::Data(G1CollectedHeap* g1_heap) :
+ _eden_length(g1_heap->eden_regions_count()),
+ _survivor_length(g1_heap->survivor_regions_count()),
+ _old_length(g1_heap->old_regions_count()),
+ _archive_length(g1_heap->archive_regions_count()),
+ _humongous_length(g1_heap->humongous_regions_count()),
+ _eden_length_per_node(NULL),
+ _survivor_length_per_node(NULL) {
+
+ uint node_count = G1NUMA::numa()->num_active_nodes();
+
+ if (node_count > 1) {
+ LogTarget(Debug, gc, heap, numa) lt;
+
+ if (lt.is_enabled()) {
+ _eden_length_per_node = NEW_C_HEAP_ARRAY(uint, node_count, mtGC);
+ _survivor_length_per_node = NEW_C_HEAP_ARRAY(uint, node_count, mtGC);
+
+ for (uint i = 0; i < node_count; i++) {
+ _eden_length_per_node[i] = g1_heap->eden_regions_count(i);
+ _survivor_length_per_node[i] = g1_heap->survivor_regions_count(i);
+ }
+ }
+ }
+}
+
+G1HeapTransition::Data::~Data() {
+ FREE_C_HEAP_ARRAY(uint, _eden_length_per_node);
+ FREE_C_HEAP_ARRAY(uint, _survivor_length_per_node);
}
G1HeapTransition::G1HeapTransition(G1CollectedHeap* g1_heap) : _g1_heap(g1_heap), _before(g1_heap) { }
struct DetailedUsage : public StackObj {
@@ -82,10 +105,38 @@
}
return false;
}
};
+static void log_regions(const char* msg, size_t before_length, size_t after_length, size_t capacity,
+ uint* before_per_node_length, uint* after_per_node_length) {
+ LogTarget(Info, gc, heap) lt;
+
+ if (lt.is_enabled()) {
+ LogStream ls(lt);
+
+ ls.print("%s regions: " SIZE_FORMAT "->" SIZE_FORMAT "(" SIZE_FORMAT ")",
+ msg, before_length, after_length, capacity);
+ // Not NULL only if gc+heap+numa at Debug level is enabled.
+ if (before_per_node_length != NULL && after_per_node_length != NULL) {
+ G1NUMA* numa = G1NUMA::numa();
+ uint num_nodes = numa->num_active_nodes();
+ const int* node_ids = numa->node_ids();
+ ls.print(" (");
+ for (uint i = 0; i < num_nodes; i++) {
+ ls.print("%d: %u->%u", node_ids[i], before_per_node_length[i], after_per_node_length[i]);
+ // Skip adding below if it is the last one.
+ if (i != num_nodes - 1) {
+ ls.print(", ");
+ }
+ }
+ ls.print(")");
+ }
+ ls.print_cr("");
+ }
+}
+
void G1HeapTransition::print() {
Data after(_g1_heap);
size_t eden_capacity_length_after_gc = _g1_heap->policy()->young_list_target_length() - after._survivor_length;
size_t survivor_capacity_length_before_gc = _g1_heap->policy()->max_survivor_regions();
@@ -104,16 +155,16 @@
after._archive_length, usage._archive_region_count);
assert(usage._humongous_region_count == after._humongous_length, "Expected humongous to be " SIZE_FORMAT " but was " SIZE_FORMAT,
after._humongous_length, usage._humongous_region_count);
}
- log_info(gc, heap)("Eden regions: " SIZE_FORMAT "->" SIZE_FORMAT "(" SIZE_FORMAT ")",
- _before._eden_length, after._eden_length, eden_capacity_length_after_gc);
+ log_regions("Eden", _before._eden_length, after._eden_length, eden_capacity_length_after_gc,
+ _before._eden_length_per_node, after._eden_length_per_node);
log_trace(gc, heap)(" Used: 0K, Waste: 0K");
- log_info(gc, heap)("Survivor regions: " SIZE_FORMAT "->" SIZE_FORMAT "(" SIZE_FORMAT ")",
- _before._survivor_length, after._survivor_length, survivor_capacity_length_before_gc);
+ log_regions("Survivor", _before._survivor_length, after._survivor_length, survivor_capacity_length_before_gc,
+ _before._survivor_length_per_node, after._survivor_length_per_node);
log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K",
usage._survivor_used / K, ((after._survivor_length * HeapRegion::GrainBytes) - usage._survivor_used) / K);
log_info(gc, heap)("Old regions: " SIZE_FORMAT "->" SIZE_FORMAT,
_before._old_length, after._old_length);
< prev index next >