Skip to content

8364531: G1: Factor out liveness tracing code #26591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 32 additions & 48 deletions src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2975,7 +2975,6 @@ G1CMTask::G1CMTask(uint worker_id,
#define G1PPRL_BYTE_FORMAT " %9zu"
#define G1PPRL_BYTE_H_FORMAT " %9s"
#define G1PPRL_DOUBLE_FORMAT "%14.1f"
#define G1PPRL_GCEFF_FORMAT " %14s"
#define G1PPRL_GCEFF_H_FORMAT " %14s"
#define G1PPRL_GID_H_FORMAT " %9s"
#define G1PPRL_GID_FORMAT " " UINT32_FORMAT_W(9)
Expand Down Expand Up @@ -3090,7 +3089,7 @@ G1PrintRegionLivenessInfoClosure::~G1PrintRegionLivenessInfoClosure() {
// add static memory usages to remembered set sizes
_total_remset_bytes += G1HeapRegionRemSet::static_mem_size();

do_cset_groups();
log_cset_candidate_groups();

// Print the footer of the output.
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX);
Expand All @@ -3110,10 +3109,33 @@ G1PrintRegionLivenessInfoClosure::~G1PrintRegionLivenessInfoClosure() {
bytes_to_mb(_total_code_roots_bytes));
}

void G1PrintRegionLivenessInfoClosure::do_cset_groups() {
void G1PrintRegionLivenessInfoClosure::log_cset_candidate_group(G1CSetCandidateGroup* group, const char* type) {
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX
G1PPRL_GID_FORMAT
G1PPRL_LEN_FORMAT
G1PPRL_GID_GCEFF_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_TYPE_H_FORMAT,
group->group_id(),
group->length(),
group->gc_efficiency(),
group->liveness(),
group->card_set()->mem_size(),
type);
}

void G1PrintRegionLivenessInfoClosure::log_cset_candidate_grouplist(G1CSetCandidateGroupList& gl, const char* type) {
for (G1CSetCandidateGroup* group : gl) {
log_cset_candidate_group(group, type);
_total_remset_bytes += group->card_set()->mem_size();
}
}

void G1PrintRegionLivenessInfoClosure::log_cset_candidate_groups() {
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX);
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX" Collectionset Candidate Groups");
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX " Types: Y=Young Regions, M=From Marking Regions, R=Retained Regions");
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX" Collection Set Candidate Groups");
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX " Types: Y=Young, M=From Marking Regions, R=Retained Regions");
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX
G1PPRL_GID_H_FORMAT
G1PPRL_LEN_H_FORMAT
Expand All @@ -3137,49 +3159,11 @@ void G1PrintRegionLivenessInfoClosure::do_cset_groups() {
"(bytes)", "");

G1CollectedHeap* g1h = G1CollectedHeap::heap();
G1CSetCandidateGroup* young_only_cset_group =g1h->young_regions_cset_group();

_total_remset_bytes += young_only_cset_group->card_set()->mem_size();
log_cset_candidate_group(g1h->young_regions_cset_group(), "Y");
_total_remset_bytes += g1h->young_regions_cset_group()->card_set()->mem_size();

log_trace(gc, liveness)(G1PPRL_LINE_PREFIX
G1PPRL_GID_FORMAT
G1PPRL_LEN_FORMAT
G1PPRL_GCEFF_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_TYPE_H_FORMAT,
young_only_cset_group->group_id(), young_only_cset_group->length(),
"-",
size_t(0), young_only_cset_group->card_set()->mem_size(),
"Y");

for (G1CSetCandidateGroup* group : g1h->policy()->candidates()->from_marking_groups()) {
_total_remset_bytes += group->card_set()->mem_size();
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX
G1PPRL_GID_FORMAT
G1PPRL_LEN_FORMAT
G1PPRL_GID_GCEFF_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_TYPE_H_FORMAT,
group->group_id(), group->length(),
group->gc_efficiency(),
group->liveness(), group->card_set()->mem_size(),
"M");
}

for (G1CSetCandidateGroup* group : g1h->policy()->candidates()->retained_groups()) {
_total_remset_bytes += group->card_set()->mem_size();
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX
G1PPRL_GID_FORMAT
G1PPRL_LEN_FORMAT
G1PPRL_GID_GCEFF_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_TYPE_H_FORMAT,
group->group_id(), group->length(),
group->gc_efficiency(),
group->liveness(), group->card_set()->mem_size(),
"R");
}
G1CollectionSetCandidates * candidates = g1h->policy()->candidates();
log_cset_candidate_grouplist(candidates->from_marking_groups(), "M");
log_cset_candidate_grouplist(candidates->retained_groups(), "R");
}
6 changes: 5 additions & 1 deletion src/hotspot/share/gc/g1/g1ConcurrentMark.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

class ConcurrentGCTimer;
class G1CollectedHeap;
class G1CSetCandidateGroup;
class G1CSetCandidateGroupList;
class G1ConcurrentMark;
class G1ConcurrentMarkThread;
class G1CMOopClosure;
Expand Down Expand Up @@ -974,7 +976,9 @@ class G1PrintRegionLivenessInfoClosure : public G1HeapRegionClosure {
return (double) val / (double) M;
}

void do_cset_groups();
void log_cset_candidate_group(G1CSetCandidateGroup* gr, const char* type);
void log_cset_candidate_grouplist(G1CSetCandidateGroupList& gl, const char* type);
void log_cset_candidate_groups();

public:
// The header and footer are printed in the constructor and
Expand Down