Skip to content

Commit 5e48c76

Browse files
author
Thomas Schatzl
committed
8228388: Add information about dirty/skipped card for Merge HCC in G1 log
Collect and print informatio about the number of processed cards during the Merge HCC phase to improve log output. Reviewed-by: kbarrett, sangheki
1 parent b3c21d9 commit 5e48c76

File tree

4 files changed

+65
-0
lines changed

4 files changed

+65
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,14 @@ G1GCPhaseTimes::G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads) :
8686
_gc_par_phases[MergeLB] = new WorkerDataArray<double>(max_gc_threads, "Log Buffers (ms):");
8787
if (G1HotCardCache::default_use_cache()) {
8888
_gc_par_phases[MergeHCC] = new WorkerDataArray<double>(max_gc_threads, "Hot Card Cache (ms):");
89+
_merge_hcc_dirty_cards = new WorkerDataArray<size_t>(max_gc_threads, "Dirty Cards:");
90+
_gc_par_phases[MergeHCC]->link_thread_work_items(_merge_hcc_dirty_cards, MergeHCCDirtyCards);
91+
_merge_hcc_skipped_cards = new WorkerDataArray<size_t>(max_gc_threads, "Skipped Cards:");
92+
_gc_par_phases[MergeHCC]->link_thread_work_items(_merge_hcc_skipped_cards, MergeHCCSkippedCards);
8993
} else {
9094
_gc_par_phases[MergeHCC] = NULL;
95+
_merge_hcc_dirty_cards = NULL;
96+
_merge_hcc_skipped_cards = NULL;
9197
}
9298
_gc_par_phases[ScanHR] = new WorkerDataArray<double>(max_gc_threads, "Scan Heap Roots (ms):");
9399
_gc_par_phases[OptScanHR] = new WorkerDataArray<double>(max_gc_threads, "Optional Scan Heap Roots (ms):");

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ class G1GCPhaseTimes : public CHeapObj<mtGC> {
100100
ScanHRUsedMemory
101101
};
102102

103+
enum GCMergeHCCWorkItems {
104+
MergeHCCDirtyCards,
105+
MergeHCCSkippedCards
106+
};
107+
103108
enum GCMergeLBWorkItems {
104109
MergeLBProcessedBuffers,
105110
MergeLBDirtyCards,
@@ -121,6 +126,9 @@ class G1GCPhaseTimes : public CHeapObj<mtGC> {
121126
WorkerDataArray<size_t>* _merge_rs_merged_fine;
122127
WorkerDataArray<size_t>* _merge_rs_merged_coarse;
123128

129+
WorkerDataArray<size_t>* _merge_hcc_dirty_cards;
130+
WorkerDataArray<size_t>* _merge_hcc_skipped_cards;
131+
124132
WorkerDataArray<size_t>* _merge_lb_processed_buffers;
125133
WorkerDataArray<size_t>* _merge_lb_dirty_cards;
126134
WorkerDataArray<size_t>* _merge_lb_skipped_cards;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,9 @@ class G1MergeHeapRootsTask : public AbstractGangTask {
11471147
G1GCParPhaseTimesTracker x(p, G1GCPhaseTimes::MergeHCC, worker_id);
11481148
G1MergeLogBufferCardsClosure cl(g1h, _scan_state);
11491149
g1h->iterate_hcc_closure(&cl, worker_id);
1150+
1151+
p->record_thread_work_item(G1GCPhaseTimes::MergeHCC, worker_id, cl.cards_dirty(), G1GCPhaseTimes::MergeHCCDirtyCards);
1152+
p->record_thread_work_item(G1GCPhaseTimes::MergeHCC, worker_id, cl.cards_skipped(), G1GCPhaseTimes::MergeHCCSkippedCards);
11501153
}
11511154

11521155
// Now apply the closure to all remaining log entries.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
package gc.g1;
25+
26+
/*
27+
* @test TestNoUseHCC
28+
* @summary Check that G1 survives a GC without HCC enabled
29+
* @requires vm.gc.G1
30+
* @key gc
31+
* @modules java.base/jdk.internal.misc
32+
* @library /test/lib
33+
* @build sun.hotspot.WhiteBox
34+
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
35+
* @run main/othervm -Xbootclasspath/a:. -Xlog:gc+phases=debug -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UseG1GC -Xmx64M -XX:G1ConcRSLogCacheSize=0 gc.g1.TestNoUseHCC
36+
*/
37+
38+
import sun.hotspot.WhiteBox;
39+
40+
public class TestNoUseHCC {
41+
42+
private static final WhiteBox WB = WhiteBox.getWhiteBox();
43+
44+
public static void main(String [] args) {
45+
WB.youngGC();
46+
}
47+
}
48+

0 commit comments

Comments
 (0)