mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-15 18:33:41 +00:00
8305716: Enhancements for printing age tables
Reviewed-by: kdnilsen, ysr, tschatzl
This commit is contained in:
parent
ebba42ac52
commit
9fb53adfe0
@ -33,15 +33,16 @@
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "runtime/perfData.hpp"
|
||||
#include "utilities/copy.hpp"
|
||||
#include "logging/logStream.hpp"
|
||||
|
||||
/* Copyright (c) 1992, 2021, Oracle and/or its affiliates, and Stanford University.
|
||||
See the LICENSE file for license information. */
|
||||
|
||||
AgeTable::AgeTable(bool global) {
|
||||
AgeTable::AgeTable(bool global) : _use_perf_data(UsePerfData && global) {
|
||||
|
||||
clear();
|
||||
|
||||
if (UsePerfData && global) {
|
||||
if (_use_perf_data) {
|
||||
|
||||
ResourceMark rm;
|
||||
EXCEPTION_MARK;
|
||||
@ -70,7 +71,7 @@ void AgeTable::clear() {
|
||||
}
|
||||
}
|
||||
|
||||
void AgeTable::merge(AgeTable* subTable) {
|
||||
void AgeTable::merge(const AgeTable* subTable) {
|
||||
for (int i = 0; i < table_size; i++) {
|
||||
sizes[i]+= subTable->sizes[i];
|
||||
}
|
||||
@ -105,25 +106,30 @@ uint AgeTable::compute_tenuring_threshold(size_t desired_survivor_size) {
|
||||
}
|
||||
|
||||
void AgeTable::print_age_table(uint tenuring_threshold) {
|
||||
if (log_is_enabled(Trace, gc, age) || UsePerfData || AgeTableTracer::is_tenuring_distribution_event_enabled()) {
|
||||
log_trace(gc, age)("Age table with threshold %u (max threshold " UINTX_FORMAT ")",
|
||||
tenuring_threshold, MaxTenuringThreshold);
|
||||
|
||||
size_t total = 0;
|
||||
uint age = 1;
|
||||
while (age < table_size) {
|
||||
size_t wordSize = sizes[age];
|
||||
total += wordSize;
|
||||
if (wordSize > 0) {
|
||||
log_trace(gc, age)("- age %3u: " SIZE_FORMAT_W(10) " bytes, " SIZE_FORMAT_W(10) " total",
|
||||
age, wordSize * oopSize, total * oopSize);
|
||||
}
|
||||
AgeTableTracer::send_tenuring_distribution_event(age, wordSize * oopSize);
|
||||
if (UsePerfData) {
|
||||
_perf_sizes[age]->set_value(wordSize * oopSize);
|
||||
}
|
||||
age++;
|
||||
}
|
||||
LogTarget(Trace, gc, age) lt;
|
||||
if (lt.is_enabled() || _use_perf_data || AgeTableTracer::is_tenuring_distribution_event_enabled()) {
|
||||
LogStream st(lt);
|
||||
print_on(&st, tenuring_threshold);
|
||||
}
|
||||
}
|
||||
|
||||
void AgeTable::print_on(outputStream* st, uint tenuring_threshold) {
|
||||
st->print_cr("Age table with threshold %u (max threshold " UINTX_FORMAT ")",
|
||||
tenuring_threshold, MaxTenuringThreshold);
|
||||
|
||||
size_t total = 0;
|
||||
uint age = 1;
|
||||
while (age < table_size) {
|
||||
size_t word_size = sizes[age];
|
||||
total += word_size;
|
||||
if (word_size > 0) {
|
||||
st->print_cr("- age %3u: " SIZE_FORMAT_W(10) " bytes, " SIZE_FORMAT_W(10) " total",
|
||||
age, word_size * oopSize, total * oopSize);
|
||||
}
|
||||
AgeTableTracer::send_tenuring_distribution_event(age, word_size * oopSize);
|
||||
if (_use_perf_data) {
|
||||
_perf_sizes[age]->set_value(word_size * oopSize);
|
||||
}
|
||||
age++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,14 +63,15 @@ class AgeTable {
|
||||
|
||||
// Merge another age table with the current one. Used
|
||||
// for parallel young generation gc.
|
||||
void merge(AgeTable* subTable);
|
||||
void merge(const AgeTable* subTable);
|
||||
|
||||
// Calculate new tenuring threshold based on age information.
|
||||
uint compute_tenuring_threshold(size_t desired_survivor_size);
|
||||
void print_age_table(uint tenuring_threshold);
|
||||
void print_on(outputStream* st, uint tenuring_threshold);
|
||||
|
||||
private:
|
||||
|
||||
bool _use_perf_data;
|
||||
PerfVariable* _perf_sizes[table_size];
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user