8133043: Clean up code related to termination stats printing
Reformat termination stats related code to make it look more similar to existing code. Reviewed-by: jwilhelm, jmasa
This commit is contained in:
parent
6e3ffb1aae
commit
183850cec4
@ -4449,9 +4449,6 @@ protected:
|
||||
ParallelTaskTerminator _terminator;
|
||||
uint _n_workers;
|
||||
|
||||
Mutex _stats_lock;
|
||||
Mutex* stats_lock() { return &_stats_lock; }
|
||||
|
||||
public:
|
||||
G1ParTask(G1CollectedHeap* g1h, RefToScanQueueSet *task_queues, G1RootProcessor* root_processor, uint n_workers)
|
||||
: AbstractGangTask("G1 collection"),
|
||||
@ -4459,8 +4456,7 @@ public:
|
||||
_queues(task_queues),
|
||||
_root_processor(root_processor),
|
||||
_terminator(n_workers, _queues),
|
||||
_n_workers(n_workers),
|
||||
_stats_lock(Mutex::leaf, "parallel G1 stats lock", true)
|
||||
_n_workers(n_workers)
|
||||
{}
|
||||
|
||||
RefToScanQueueSet* queues() { return _queues; }
|
||||
@ -4587,8 +4583,8 @@ public:
|
||||
_g1h->update_surviving_young_words(pss.surviving_young_words()+1);
|
||||
|
||||
if (PrintTerminationStats) {
|
||||
MutexLocker x(stats_lock());
|
||||
pss.print_termination_stats(worker_id);
|
||||
MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
|
||||
pss.print_termination_stats();
|
||||
}
|
||||
|
||||
assert(pss.queue_is_empty(), "should be empty");
|
||||
@ -5504,7 +5500,9 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) {
|
||||
}
|
||||
|
||||
// The individual threads will set their evac-failure closures.
|
||||
if (PrintTerminationStats) G1ParScanThreadState::print_termination_stats_hdr();
|
||||
if (PrintTerminationStats) {
|
||||
G1ParScanThreadState::print_termination_stats_hdr();
|
||||
}
|
||||
|
||||
workers()->run_task(&g1_par_task);
|
||||
end_par_time_sec = os::elapsedTime();
|
||||
|
@ -76,32 +76,24 @@ G1ParScanThreadState::~G1ParScanThreadState() {
|
||||
FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base);
|
||||
}
|
||||
|
||||
void
|
||||
G1ParScanThreadState::print_termination_stats_hdr(outputStream* const st)
|
||||
{
|
||||
void G1ParScanThreadState::print_termination_stats_hdr(outputStream* const st) {
|
||||
st->print_raw_cr("GC Termination Stats");
|
||||
st->print_raw_cr(" elapsed --strong roots-- -------termination-------"
|
||||
" ------waste (KiB)------");
|
||||
st->print_raw_cr("thr ms ms % ms % attempts"
|
||||
" total alloc undo");
|
||||
st->print_raw_cr("--- --------- --------- ------ --------- ------ --------"
|
||||
" ------- ------- -------");
|
||||
st->print_raw_cr(" elapsed --strong roots-- -------termination------- ------waste (KiB)------");
|
||||
st->print_raw_cr("thr ms ms % ms % attempts total alloc undo");
|
||||
st->print_raw_cr("--- --------- --------- ------ --------- ------ -------- ------- ------- -------");
|
||||
}
|
||||
|
||||
void
|
||||
G1ParScanThreadState::print_termination_stats(int i,
|
||||
outputStream* const st) const
|
||||
{
|
||||
void G1ParScanThreadState::print_termination_stats(outputStream* const st) const {
|
||||
const double elapsed_ms = elapsed_time() * 1000.0;
|
||||
const double s_roots_ms = strong_roots_time() * 1000.0;
|
||||
const double term_ms = term_time() * 1000.0;
|
||||
size_t alloc_buffer_waste = 0;
|
||||
size_t undo_waste = 0;
|
||||
_plab_allocator->waste(alloc_buffer_waste, undo_waste);
|
||||
st->print_cr("%3d %9.2f %9.2f %6.2f "
|
||||
st->print_cr("%3u %9.2f %9.2f %6.2f "
|
||||
"%9.2f %6.2f " SIZE_FORMAT_W(8) " "
|
||||
SIZE_FORMAT_W(7) " " SIZE_FORMAT_W(7) " " SIZE_FORMAT_W(7),
|
||||
i, elapsed_ms, s_roots_ms, s_roots_ms * 100 / elapsed_ms,
|
||||
_queue_num, elapsed_ms, s_roots_ms, s_roots_ms * 100 / elapsed_ms,
|
||||
term_ms, term_ms * 100 / elapsed_ms, term_attempts(),
|
||||
(alloc_buffer_waste + undo_waste) * HeapWordSize / K,
|
||||
alloc_buffer_waste * HeapWordSize / K,
|
||||
|
@ -139,8 +139,11 @@ class G1ParScanThreadState : public StackObj {
|
||||
return os::elapsedTime() - _start;
|
||||
}
|
||||
|
||||
// Print the header for the per-thread termination statistics.
|
||||
static void print_termination_stats_hdr(outputStream* const st = gclog_or_tty);
|
||||
void print_termination_stats(int i, outputStream* const st = gclog_or_tty) const;
|
||||
|
||||
// Print actual per-thread termination statistics.
|
||||
void print_termination_stats(outputStream* const st = gclog_or_tty) const;
|
||||
|
||||
size_t* surviving_young_words() {
|
||||
// We add on to hide entry 0 which accumulates surviving words for
|
||||
|
Loading…
Reference in New Issue
Block a user