8277814: ConcurrentRefineThread should report rate when deactivating

Reviewed-by: tschatzl, sjohanss
This commit is contained in:
Kim Barrett 2021-12-01 00:44:51 +00:00
parent 65251f7693
commit dd73e3cea2
3 changed files with 15 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,6 +32,12 @@ G1ConcurrentRefineStats::G1ConcurrentRefineStats() :
_dirtied_cards(0) _dirtied_cards(0)
{} {}
double G1ConcurrentRefineStats::refinement_rate_ms() const {
// Report 0 when no time recorded because no refinement performed.
double secs = refinement_time().seconds();
return (secs > 0) ? (refined_cards() / (secs * MILLIUNITS)) : 0.0;
}
G1ConcurrentRefineStats& G1ConcurrentRefineStats&
G1ConcurrentRefineStats::operator+=(const G1ConcurrentRefineStats& other) { G1ConcurrentRefineStats::operator+=(const G1ConcurrentRefineStats& other) {
_refinement_time += other._refinement_time; _refinement_time += other._refinement_time;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -47,6 +47,9 @@ public:
// Number of refined cards. // Number of refined cards.
size_t refined_cards() const { return _refined_cards; } size_t refined_cards() const { return _refined_cards; }
// Refinement rate, in cards per ms.
double refinement_rate_ms() const;
// Number of cards for which refinement was skipped because some other // Number of cards for which refinement was skipped because some other
// thread had already refined them. // thread had already refined them.
size_t precleaned_cards() const { return _precleaned_cards; } size_t precleaned_cards() const { return _precleaned_cards; }

View File

@ -131,12 +131,12 @@ void G1ConcurrentRefineThread::run_service() {
} }
total_stats += *_refinement_stats - start_stats; total_stats += *_refinement_stats - start_stats;
log_debug(gc, refine)("Deactivated worker %d, off threshold: " SIZE_FORMAT log_debug(gc, refine)("Deactivated worker %d, off threshold: %zu, "
", current: " SIZE_FORMAT "cards: %zu, refined %zu, rate %1.2fc/ms",
", refined cards: " SIZE_FORMAT,
_worker_id, _cr->deactivation_threshold(_worker_id), _worker_id, _cr->deactivation_threshold(_worker_id),
G1BarrierSet::dirty_card_queue_set().num_cards(), G1BarrierSet::dirty_card_queue_set().num_cards(),
total_stats.refined_cards()); total_stats.refined_cards(),
total_stats.refinement_rate_ms());
if (os::supports_vtime()) { if (os::supports_vtime()) {
_vtime_accum = (os::elapsedVTime() - _vtime_start); _vtime_accum = (os::elapsedVTime() - _vtime_start);