< prev index next >
src/share/vm/gc/g1/workerDataArray.inline.hpp
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 76,95 ****
_data[worker_i] += value;
}
template <typename T>
double WorkerDataArray<T>::average() const {
! uint active_threads = 0;
for (uint i = 0; i < _length; ++i) {
if (get(i) != uninitialized()) {
! active_threads++;
}
}
! if (active_threads == 0) {
return 0.0;
}
! return sum() / (double) active_threads;
}
template <typename T>
T WorkerDataArray<T>::sum() const {
T s = 0;
--- 76,95 ----
_data[worker_i] += value;
}
template <typename T>
double WorkerDataArray<T>::average() const {
! uint contributing_threads = 0;
for (uint i = 0; i < _length; ++i) {
if (get(i) != uninitialized()) {
! contributing_threads++;
}
}
! if (contributing_threads == 0) {
return 0.0;
}
! return sum() / (double) contributing_threads;
}
template <typename T>
T WorkerDataArray<T>::sum() const {
T s = 0;
*** 117,141 ****
}
if (start < _length) {
T min = get(start);
T max = min;
T sum = 0;
! uint active_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;
! active_threads++;
}
}
T diff = max - min;
! assert(active_threads != 0, "Must be since we found a used value for the start index");
! double avg = sum / (double) active_threads;
WDAPrinter::summary(out, min, avg, max, diff, sum, print_sum);
! out->print_cr(", Workers: %d", active_threads);
} else {
// No data for this phase.
out->print_cr(" skipped");
}
}
--- 117,141 ----
}
if (start < _length) {
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);
} else {
// No data for this phase.
out->print_cr(" skipped");
}
}
< prev index next >