Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8277560: Remove WorkerDataArray::_is_serial
Reviewed-by: sjohanss, tschatzl
  • Loading branch information
albertnetymk committed Nov 23, 2021
1 parent 017df14 commit 36b887a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 42 deletions.
10 changes: 0 additions & 10 deletions src/hotspot/share/gc/shared/workerDataArray.cpp
Expand Up @@ -36,16 +36,6 @@ double WorkerDataArray<double>::uninitialized() {
return -1.0;
}

template <>
void WorkerDataArray<double>::WDAPrinter::summary(outputStream* out, double time) {
out->print_cr(" %.1lfms", time * MILLIUNITS);
}

template <>
void WorkerDataArray<size_t>::WDAPrinter::summary(outputStream* out, size_t value) {
out->print_cr(" " SIZE_FORMAT, value);
}

template <>
void WorkerDataArray<double>::WDAPrinter::summary(outputStream* out, double min, double avg, double max, double diff, double sum, bool print_sum) {
out->print(" Min: %4.1lf, Avg: %4.1lf, Max: %4.1lf, Diff: %4.1lf", min * MILLIUNITS, avg * MILLIUNITS, max * MILLIUNITS, diff* MILLIUNITS);
Expand Down
4 changes: 1 addition & 3 deletions src/hotspot/share/gc/shared/workerDataArray.hpp
Expand Up @@ -46,7 +46,7 @@ class WorkerDataArray : public CHeapObj<mtGC> {
WorkerDataArray<size_t>* _thread_work_items[MaxThreadWorkItems];

public:
WorkerDataArray(const char* short_name, const char* title, uint length, bool is_serial = false);
WorkerDataArray(const char* short_name, const char* title, uint length);
~WorkerDataArray();

// Create an integer sub-item at the given index to this WorkerDataArray. If length_override
Expand Down Expand Up @@ -91,9 +91,7 @@ class WorkerDataArray : public CHeapObj<mtGC> {
private:
class WDAPrinter {
public:
static void summary(outputStream* out, double time);
static void summary(outputStream* out, double min, double avg, double max, double diff, double sum, bool print_sum);
static void summary(outputStream* out, size_t value);
static void summary(outputStream* out, size_t min, double avg, size_t max, size_t diff, size_t sum, bool print_sum);

static void details(const WorkerDataArray<double>* phase, outputStream* out);
Expand Down
48 changes: 19 additions & 29 deletions src/hotspot/share/gc/shared/workerDataArray.inline.hpp
Expand Up @@ -31,14 +31,12 @@
#include "utilities/ostream.hpp"

template <typename T>
WorkerDataArray<T>::WorkerDataArray(const char* short_name, const char* title, uint length, bool is_serial) :
WorkerDataArray<T>::WorkerDataArray(const char* short_name, const char* title, uint length) :
_data(NULL),
_length(length),
_short_name(short_name),
_title(title),
_is_serial(is_serial) {
_title(title) {
assert(length > 0, "Must have some workers to store data for");
assert(!is_serial || length == 1, "Serial phase must only have a single entry.");
_data = NEW_C_HEAP_ARRAY(T, _length, mtGC);
for (uint i = 0; i < MaxThreadWorkItems; i++) {
_thread_work_items[i] = NULL;
Expand Down Expand Up @@ -158,39 +156,31 @@ void WorkerDataArray<T>::set_all(T value) {

template <class T>
void WorkerDataArray<T>::print_summary_on(outputStream* out, bool print_sum) const {
if (_is_serial) {
out->print("%s:", title());
} else {
out->print("%-30s", title());
}
out->print("%-30s", title());

uint start = 0;
while (start < _length && get(start) == uninitialized()) {
start++;
}
if (start < _length) {
if (_is_serial) {
WDAPrinter::summary(out, get(0));
} else {
T min = get(start);
T max = min;
T sum = 0;
uint contributing_threads = 0;
for (uint i = start; i < _length; ++i) {
T value = get(i);
if (value != uninitialized()) {
max = MAX2(max, value);
min = MIN2(min, value);
sum += value;
contributing_threads++;
}
T min = get(start);
T max = min;
T sum = 0;
uint contributing_threads = 0;
for (uint i = start; i < _length; ++i) {
T value = get(i);
if (value != uninitialized()) {
max = MAX2(max, value);
min = MIN2(min, value);
sum += value;
contributing_threads++;
}
T diff = max - min;
assert(contributing_threads != 0, "Must be since we found a used value for the start index");
double avg = sum / (double) contributing_threads;
WDAPrinter::summary(out, min, avg, max, diff, sum, print_sum);
out->print_cr(", Workers: %d", contributing_threads);
}
T diff = max - min;
assert(contributing_threads != 0, "Must be since we found a used value for the start index");
double avg = sum / (double) contributing_threads;
WDAPrinter::summary(out, min, avg, max, diff, sum, print_sum);
out->print_cr(", Workers: %d", contributing_threads);
} else {
// No data for this phase.
out->print_cr(" skipped");
Expand Down

1 comment on commit 36b887a

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.