Skip to content

Commit d906e45

Browse files
author
Thomas Schatzl
committed
8364531: G1: Factor out liveness tracing code
Reviewed-by: ayang, sangheki
1 parent 8a571ee commit d906e45

File tree

2 files changed

+36
-49
lines changed

2 files changed

+36
-49
lines changed

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp

Lines changed: 31 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2975,7 +2975,6 @@ G1CMTask::G1CMTask(uint worker_id,
29752975
#define G1PPRL_BYTE_FORMAT " %9zu"
29762976
#define G1PPRL_BYTE_H_FORMAT " %9s"
29772977
#define G1PPRL_DOUBLE_FORMAT "%14.1f"
2978-
#define G1PPRL_GCEFF_FORMAT " %14s"
29792978
#define G1PPRL_GCEFF_H_FORMAT " %14s"
29802979
#define G1PPRL_GID_H_FORMAT " %9s"
29812980
#define G1PPRL_GID_FORMAT " " UINT32_FORMAT_W(9)
@@ -3090,7 +3089,7 @@ G1PrintRegionLivenessInfoClosure::~G1PrintRegionLivenessInfoClosure() {
30903089
// add static memory usages to remembered set sizes
30913090
_total_remset_bytes += G1HeapRegionRemSet::static_mem_size();
30923091

3093-
do_cset_groups();
3092+
log_cset_candidate_groups();
30943093

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

3113-
void G1PrintRegionLivenessInfoClosure::do_cset_groups() {
3112+
void G1PrintRegionLivenessInfoClosure::log_cset_candidate_group_add_total(G1CSetCandidateGroup* group, const char* type) {
3113+
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX
3114+
G1PPRL_GID_FORMAT
3115+
G1PPRL_LEN_FORMAT
3116+
G1PPRL_GID_GCEFF_FORMAT
3117+
G1PPRL_BYTE_FORMAT
3118+
G1PPRL_BYTE_FORMAT
3119+
G1PPRL_TYPE_H_FORMAT,
3120+
group->group_id(),
3121+
group->length(),
3122+
group->gc_efficiency(),
3123+
group->liveness(),
3124+
group->card_set()->mem_size(),
3125+
type);
3126+
_total_remset_bytes += group->card_set()->mem_size();
3127+
}
3128+
3129+
void G1PrintRegionLivenessInfoClosure::log_cset_candidate_grouplist(G1CSetCandidateGroupList& gl, const char* type) {
3130+
for (G1CSetCandidateGroup* group : gl) {
3131+
log_cset_candidate_group_add_total(group, type);
3132+
}
3133+
}
3134+
3135+
void G1PrintRegionLivenessInfoClosure::log_cset_candidate_groups() {
31143136
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX);
3115-
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX" Collectionset Candidate Groups");
3116-
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX " Types: Y=Young Regions, M=From Marking Regions, R=Retained Regions");
3137+
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX" Collection Set Candidate Groups");
3138+
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX " Types: Y=Young, M=From Marking Regions, R=Retained Regions");
31173139
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX
31183140
G1PPRL_GID_H_FORMAT
31193141
G1PPRL_LEN_H_FORMAT
@@ -3137,49 +3159,10 @@ void G1PrintRegionLivenessInfoClosure::do_cset_groups() {
31373159
"(bytes)", "");
31383160

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

3142-
_total_remset_bytes += young_only_cset_group->card_set()->mem_size();
3163+
log_cset_candidate_group_add_total(g1h->young_regions_cset_group(), "Y");
31433164

3144-
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX
3145-
G1PPRL_GID_FORMAT
3146-
G1PPRL_LEN_FORMAT
3147-
G1PPRL_GCEFF_FORMAT
3148-
G1PPRL_BYTE_FORMAT
3149-
G1PPRL_BYTE_FORMAT
3150-
G1PPRL_TYPE_H_FORMAT,
3151-
young_only_cset_group->group_id(), young_only_cset_group->length(),
3152-
"-",
3153-
size_t(0), young_only_cset_group->card_set()->mem_size(),
3154-
"Y");
3155-
3156-
for (G1CSetCandidateGroup* group : g1h->policy()->candidates()->from_marking_groups()) {
3157-
_total_remset_bytes += group->card_set()->mem_size();
3158-
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX
3159-
G1PPRL_GID_FORMAT
3160-
G1PPRL_LEN_FORMAT
3161-
G1PPRL_GID_GCEFF_FORMAT
3162-
G1PPRL_BYTE_FORMAT
3163-
G1PPRL_BYTE_FORMAT
3164-
G1PPRL_TYPE_H_FORMAT,
3165-
group->group_id(), group->length(),
3166-
group->gc_efficiency(),
3167-
group->liveness(), group->card_set()->mem_size(),
3168-
"M");
3169-
}
3170-
3171-
for (G1CSetCandidateGroup* group : g1h->policy()->candidates()->retained_groups()) {
3172-
_total_remset_bytes += group->card_set()->mem_size();
3173-
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX
3174-
G1PPRL_GID_FORMAT
3175-
G1PPRL_LEN_FORMAT
3176-
G1PPRL_GID_GCEFF_FORMAT
3177-
G1PPRL_BYTE_FORMAT
3178-
G1PPRL_BYTE_FORMAT
3179-
G1PPRL_TYPE_H_FORMAT,
3180-
group->group_id(), group->length(),
3181-
group->gc_efficiency(),
3182-
group->liveness(), group->card_set()->mem_size(),
3183-
"R");
3184-
}
3165+
G1CollectionSetCandidates* candidates = g1h->policy()->candidates();
3166+
log_cset_candidate_grouplist(candidates->from_marking_groups(), "M");
3167+
log_cset_candidate_grouplist(candidates->retained_groups(), "R");
31853168
}

src/hotspot/share/gc/g1/g1ConcurrentMark.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242

4343
class ConcurrentGCTimer;
4444
class G1CollectedHeap;
45+
class G1CSetCandidateGroup;
46+
class G1CSetCandidateGroupList;
4547
class G1ConcurrentMark;
4648
class G1ConcurrentMarkThread;
4749
class G1CMOopClosure;
@@ -974,7 +976,9 @@ class G1PrintRegionLivenessInfoClosure : public G1HeapRegionClosure {
974976
return (double) val / (double) M;
975977
}
976978

977-
void do_cset_groups();
979+
void log_cset_candidate_group_add_total(G1CSetCandidateGroup* gr, const char* type);
980+
void log_cset_candidate_grouplist(G1CSetCandidateGroupList& gl, const char* type);
981+
void log_cset_candidate_groups();
978982

979983
public:
980984
// The header and footer are printed in the constructor and

0 commit comments

Comments
 (0)