8280397: Factor out task queue statistics printing
Reviewed-by: pliden, kbarrett, mli
This commit is contained in:
parent
8a3cca09ba
commit
ed826f2927
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2021, 2022, 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
|
||||||
@ -59,47 +59,6 @@
|
|||||||
#include "memory/resourceArea.hpp"
|
#include "memory/resourceArea.hpp"
|
||||||
#include "utilities/ticks.hpp"
|
#include "utilities/ticks.hpp"
|
||||||
|
|
||||||
#if TASKQUEUE_STATS
|
|
||||||
uint G1YoungCollector::num_task_queues() const {
|
|
||||||
return task_queues()->size();
|
|
||||||
}
|
|
||||||
|
|
||||||
void G1YoungCollector::print_taskqueue_stats_hdr(outputStream* const st) {
|
|
||||||
st->print_raw_cr("GC Task Stats");
|
|
||||||
st->print_raw("thr "); TaskQueueStats::print_header(1, st); st->cr();
|
|
||||||
st->print_raw("--- "); TaskQueueStats::print_header(2, st); st->cr();
|
|
||||||
}
|
|
||||||
|
|
||||||
void G1YoungCollector::print_taskqueue_stats() const {
|
|
||||||
if (!log_is_enabled(Trace, gc, task, stats)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log(gc, task, stats) log;
|
|
||||||
ResourceMark rm;
|
|
||||||
LogStream ls(log.trace());
|
|
||||||
outputStream* st = &ls;
|
|
||||||
|
|
||||||
print_taskqueue_stats_hdr(st);
|
|
||||||
|
|
||||||
TaskQueueStats totals;
|
|
||||||
const uint n = num_task_queues();
|
|
||||||
for (uint i = 0; i < n; ++i) {
|
|
||||||
st->print("%3u ", i); _g1h->task_queue(i)->stats.print(st); st->cr();
|
|
||||||
totals += _g1h->task_queue(i)->stats;
|
|
||||||
}
|
|
||||||
st->print_raw("tot "); totals.print(st); st->cr();
|
|
||||||
|
|
||||||
DEBUG_ONLY(totals.verify());
|
|
||||||
}
|
|
||||||
|
|
||||||
void G1YoungCollector::reset_taskqueue_stats() {
|
|
||||||
const uint n = num_task_queues();
|
|
||||||
for (uint i = 0; i < n; ++i) {
|
|
||||||
_g1h->task_queue(i)->stats.reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // TASKQUEUE_STATS
|
|
||||||
|
|
||||||
// GCTraceTime wrapper that constructs the message according to GC pause type and
|
// GCTraceTime wrapper that constructs the message according to GC pause type and
|
||||||
// GC cause.
|
// GC cause.
|
||||||
// The code relies on the fact that GCTraceTimeWrapper stores the string passed
|
// The code relies on the fact that GCTraceTimeWrapper stores the string passed
|
||||||
@ -1147,6 +1106,5 @@ void G1YoungCollector::collect() {
|
|||||||
|
|
||||||
policy()->record_young_collection_end(_concurrent_operation_is_full_mark, evacuation_failed());
|
policy()->record_young_collection_end(_concurrent_operation_is_full_mark, evacuation_failed());
|
||||||
}
|
}
|
||||||
TASKQUEUE_STATS_ONLY(print_taskqueue_stats());
|
TASKQUEUE_STATS_ONLY(_g1h->task_queues()->print_and_reset_taskqueue_stats("Oop Queue");)
|
||||||
TASKQUEUE_STATS_ONLY(reset_taskqueue_stats());
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2021, 2022, 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
|
||||||
@ -134,13 +134,6 @@ class G1YoungCollector {
|
|||||||
// True iff an evacuation has failed in the most-recent collection.
|
// True iff an evacuation has failed in the most-recent collection.
|
||||||
bool evacuation_failed() const;
|
bool evacuation_failed() const;
|
||||||
|
|
||||||
#if TASKQUEUE_STATS
|
|
||||||
uint num_task_queues() const;
|
|
||||||
static void print_taskqueue_stats_hdr(outputStream* const st);
|
|
||||||
void print_taskqueue_stats() const;
|
|
||||||
void reset_taskqueue_stats();
|
|
||||||
#endif // TASKQUEUE_STATS
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
G1YoungCollector(GCCause::Cause gc_cause,
|
G1YoungCollector(GCCause::Cause gc_cause,
|
||||||
double target_pause_time_ms);
|
double target_pause_time_ms);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2022, 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
|
||||||
@ -147,37 +147,24 @@ static const char* const pm_stats_hdr[] = {
|
|||||||
"--- ---------- ---------- ---------- ----------"
|
"--- ---------- ---------- ---------- ----------"
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void PSPromotionManager::print_taskqueue_stats() {
|
||||||
PSPromotionManager::print_taskqueue_stats() {
|
|
||||||
if (!log_is_enabled(Trace, gc, task, stats)) {
|
if (!log_is_enabled(Trace, gc, task, stats)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log(gc, task, stats) log;
|
Log(gc, task, stats) log;
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
LogStream ls(log.trace());
|
LogStream ls(log.trace());
|
||||||
outputStream* out = &ls;
|
|
||||||
out->print_cr("== GC Tasks Stats, GC %3d",
|
|
||||||
ParallelScavengeHeap::heap()->total_collections());
|
|
||||||
|
|
||||||
TaskQueueStats totals;
|
stack_array_depth()->print_taskqueue_stats(&ls, "Oop Queue");
|
||||||
out->print("thr "); TaskQueueStats::print_header(1, out); out->cr();
|
|
||||||
out->print("--- "); TaskQueueStats::print_header(2, out); out->cr();
|
|
||||||
for (uint i = 0; i < ParallelGCThreads; ++i) {
|
|
||||||
TaskQueueStats& next = manager_array(i)->_claimed_stack_depth.stats;
|
|
||||||
out->print("%3d ", i); next.print(out); out->cr();
|
|
||||||
totals += next;
|
|
||||||
}
|
|
||||||
out->print("tot "); totals.print(out); out->cr();
|
|
||||||
|
|
||||||
const uint hlines = sizeof(pm_stats_hdr) / sizeof(pm_stats_hdr[0]);
|
const uint hlines = sizeof(pm_stats_hdr) / sizeof(pm_stats_hdr[0]);
|
||||||
for (uint i = 0; i < hlines; ++i) out->print_cr("%s", pm_stats_hdr[i]);
|
for (uint i = 0; i < hlines; ++i) ls.print_cr("%s", pm_stats_hdr[i]);
|
||||||
for (uint i = 0; i < ParallelGCThreads; ++i) {
|
for (uint i = 0; i < ParallelGCThreads; ++i) {
|
||||||
manager_array(i)->print_local_stats(out, i);
|
manager_array(i)->print_local_stats(&ls, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void PSPromotionManager::reset_stats() {
|
||||||
PSPromotionManager::reset_stats() {
|
|
||||||
claimed_stack_depth()->stats.reset();
|
claimed_stack_depth()->stats.reset();
|
||||||
_array_chunk_pushes = _array_chunk_steals = 0;
|
_array_chunk_pushes = _array_chunk_steals = 0;
|
||||||
_arrays_chunked = _array_chunks_processed = 0;
|
_arrays_chunked = _array_chunks_processed = 0;
|
||||||
@ -216,8 +203,6 @@ void PSPromotionManager::reset() {
|
|||||||
|
|
||||||
// We need to get an assert in here to make sure the labs are always flushed.
|
// We need to get an assert in here to make sure the labs are always flushed.
|
||||||
|
|
||||||
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
|
|
||||||
|
|
||||||
// Do not prefill the LAB's, save heap wastage!
|
// Do not prefill the LAB's, save heap wastage!
|
||||||
HeapWord* lab_base = young_space()->top();
|
HeapWord* lab_base = young_space()->top();
|
||||||
_young_lab.initialize(MemRegion(lab_base, (size_t)0));
|
_young_lab.initialize(MemRegion(lab_base, (size_t)0));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2001, 2022, 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
|
||||||
@ -473,6 +473,18 @@ public:
|
|||||||
virtual uint tasks() const;
|
virtual uint tasks() const;
|
||||||
|
|
||||||
uint size() const { return _n; }
|
uint size() const { return _n; }
|
||||||
|
|
||||||
|
#if TASKQUEUE_STATS
|
||||||
|
private:
|
||||||
|
static void print_taskqueue_stats_hdr(outputStream* const st, const char* label);
|
||||||
|
public:
|
||||||
|
void print_taskqueue_stats(outputStream* const st, const char* label);
|
||||||
|
void reset_taskqueue_stats();
|
||||||
|
|
||||||
|
// Prints taskqueue set statistics into gc+task+stats=trace and resets
|
||||||
|
// its statistics.
|
||||||
|
void print_and_reset_taskqueue_stats(const char* label);
|
||||||
|
#endif // TASKQUEUE_STATS
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T, MEMFLAGS F> void
|
template<class T, MEMFLAGS F> void
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2022, 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
|
||||||
@ -27,11 +27,15 @@
|
|||||||
|
|
||||||
#include "gc/shared/taskqueue.hpp"
|
#include "gc/shared/taskqueue.hpp"
|
||||||
|
|
||||||
|
#include "logging/log.hpp"
|
||||||
|
#include "logging/logStream.hpp"
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
|
#include "memory/resourceArea.hpp"
|
||||||
#include "oops/oop.inline.hpp"
|
#include "oops/oop.inline.hpp"
|
||||||
#include "runtime/atomic.hpp"
|
#include "runtime/atomic.hpp"
|
||||||
#include "runtime/orderAccess.hpp"
|
#include "runtime/orderAccess.hpp"
|
||||||
#include "utilities/debug.hpp"
|
#include "utilities/debug.hpp"
|
||||||
|
#include "utilities/ostream.hpp"
|
||||||
#include "utilities/stack.inline.hpp"
|
#include "utilities/stack.inline.hpp"
|
||||||
|
|
||||||
template <class T, MEMFLAGS F>
|
template <class T, MEMFLAGS F>
|
||||||
@ -48,6 +52,51 @@ inline GenericTaskQueueSet<T, F>::~GenericTaskQueueSet() {
|
|||||||
FREE_C_HEAP_ARRAY(T*, _queues);
|
FREE_C_HEAP_ARRAY(T*, _queues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if TASKQUEUE_STATS
|
||||||
|
template<class T, MEMFLAGS F>
|
||||||
|
void GenericTaskQueueSet<T, F>::print_taskqueue_stats_hdr(outputStream* const st, const char* label) {
|
||||||
|
st->print_cr("GC Task Stats %s", label);
|
||||||
|
st->print("thr "); TaskQueueStats::print_header(1, st); st->cr();
|
||||||
|
st->print("--- "); TaskQueueStats::print_header(2, st); st->cr();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, MEMFLAGS F>
|
||||||
|
void GenericTaskQueueSet<T, F>::print_taskqueue_stats(outputStream* const st, const char* label) {
|
||||||
|
print_taskqueue_stats_hdr(st, label);
|
||||||
|
|
||||||
|
TaskQueueStats totals;
|
||||||
|
const uint n = size();
|
||||||
|
for (uint i = 0; i < n; ++i) {
|
||||||
|
st->print("%3u ", i); queue(i)->stats.print(st); st->cr();
|
||||||
|
totals += queue(i)->stats;
|
||||||
|
}
|
||||||
|
st->print_raw("tot "); totals.print(st); st->cr();
|
||||||
|
|
||||||
|
DEBUG_ONLY(totals.verify());
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, MEMFLAGS F>
|
||||||
|
void GenericTaskQueueSet<T, F>::reset_taskqueue_stats() {
|
||||||
|
const uint n = size();
|
||||||
|
for (uint i = 0; i < n; ++i) {
|
||||||
|
queue(i)->stats.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T, MEMFLAGS F>
|
||||||
|
inline void GenericTaskQueueSet<T, F>::print_and_reset_taskqueue_stats(const char* label) {
|
||||||
|
if (!log_is_enabled(Trace, gc, task, stats)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Log(gc, task, stats) log;
|
||||||
|
ResourceMark rm;
|
||||||
|
LogStream ls(log.trace());
|
||||||
|
|
||||||
|
print_taskqueue_stats(&ls, label);
|
||||||
|
reset_taskqueue_stats();
|
||||||
|
}
|
||||||
|
#endif // TASKQUEUE_STATS
|
||||||
|
|
||||||
template<class E, MEMFLAGS F, unsigned int N>
|
template<class E, MEMFLAGS F, unsigned int N>
|
||||||
inline GenericTaskQueue<E, F, N>::GenericTaskQueue() :
|
inline GenericTaskQueue<E, F, N>::GenericTaskQueue() :
|
||||||
_elems(ArrayAllocator<E>::allocate(N, F)),
|
_elems(ArrayAllocator<E>::allocate(N, F)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user