Skip to content

Commit 06b0d76

Browse files
author
Thomas Schatzl
committed
8393009: G1: Refinement errorneously subtracts yield duration from sweep duration
Reviewed-by: ayang
1 parent b52915c commit 06b0d76

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎src/hotspot/share/gc/g1/g1ConcurrentRefineStats.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void G1ConcurrentRefineStats::add_atomic(const G1LocalRefineStats* other) {
3737
}
3838

3939
void G1ConcurrentRefineStats::reset() {
40-
_sweep_duration.store_relaxed(0);
40+
_sweep_work_duration.store_relaxed(0);
4141
_yield_during_sweep_duration.store_relaxed(0);
4242
_cards_scanned.store_relaxed(0);
4343
_cards_clean.store_relaxed(0);

‎src/hotspot/share/gc/g1/g1ConcurrentRefineStats.hpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ struct G1LocalRefineStats {
5151

5252
// Global statistics for concurrent refinement processing.
5353
class G1ConcurrentRefineStats : public CHeapObj<mtGC> {
54-
Atomic<jlong> _sweep_duration; // Time spent sweeping the table finding non-clean cards
55-
// and refining them.
54+
Atomic<jlong> _sweep_work_duration; // Time spent sweeping the table finding non-clean cards
55+
// and refining them without yields.
5656
Atomic<jlong> _yield_during_sweep_duration; // Time spent yielding during the sweep (not doing the sweep).
5757

5858
Atomic<size_t> _cards_scanned; // Total number of cards scanned.
@@ -67,7 +67,7 @@ class G1ConcurrentRefineStats : public CHeapObj<mtGC> {
6767
public:
6868
// Time spent performing sweeping the refinement table (includes actual refinement,
6969
// but not yield time).
70-
inline jlong sweep_duration() const;
70+
inline jlong sweep_work_duration() const;
7171
inline jlong yield_during_sweep_duration() const;
7272
inline jlong refine_duration() const;
7373

‎src/hotspot/share/gc/g1/g1ConcurrentRefineStats.inline.hpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727

2828
#include "gc/g1/g1ConcurrentRefineStats.hpp"
2929

30-
inline jlong G1ConcurrentRefineStats::sweep_duration() const {
31-
return _sweep_duration.load_relaxed() - yield_during_sweep_duration();
30+
inline jlong G1ConcurrentRefineStats::sweep_work_duration() const {
31+
return _sweep_work_duration.load_relaxed();
3232
}
3333

3434
inline jlong G1ConcurrentRefineStats::yield_during_sweep_duration() const {
@@ -80,7 +80,7 @@ inline size_t G1ConcurrentRefineStats::cards_to_cset() const {
8080
}
8181

8282
inline void G1ConcurrentRefineStats::inc_sweep_duration(jlong t) {
83-
_sweep_duration.fetch_then_add(t, memory_order_relaxed);
83+
_sweep_work_duration.fetch_then_add(t, memory_order_relaxed);
8484
}
8585

8686
inline void G1ConcurrentRefineStats::inc_yield_during_sweep_duration(jlong t) {

‎src/hotspot/share/gc/g1/g1Policy.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ void G1Policy::record_full_collection_end(size_t allocation_word_size) {
612612
static void log_refinement_stats(const G1ConcurrentRefineStats& stats) {
613613
log_debug(gc, refine, stats)
614614
("Refinement: sweep: %.2fms, yield: %.2fms refined: %zu, dirtied: %zu",
615-
TimeHelper::counter_to_millis(stats.sweep_duration()),
615+
TimeHelper::counter_to_millis(stats.sweep_work_duration()),
616616
TimeHelper::counter_to_millis(stats.yield_during_sweep_duration()),
617617
stats.refined_cards(),
618618
stats.cards_pending());
@@ -624,7 +624,7 @@ void G1Policy::record_refinement_stats(G1ConcurrentRefineStats* refine_stats) {
624624
// Record the rate at which cards were refined.
625625
// Don't update the rate if the current sample is empty or time is zero (which is
626626
// the case during GC).
627-
double refinement_time = TimeHelper::counter_to_millis(refine_stats->sweep_duration());
627+
double refinement_time = TimeHelper::counter_to_millis(refine_stats->sweep_work_duration());
628628
size_t refined_cards = refine_stats->refined_cards();
629629
if ((refined_cards > 0) && (refinement_time > 0)) {
630630
double rate = refined_cards / refinement_time;

0 commit comments

Comments
 (0)