< prev index next >
src/share/vm/gc/g1/workerDataArray.inline.hpp
Print this page
*** 20,43 ****
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "gc/g1/workerDataArray.hpp"
#include "memory/allocation.inline.hpp"
template <typename T>
! WorkerDataArray<T>::WorkerDataArray(uint length,
! const char* title,
! bool print_sum,
! uint indent_level) :
_title(title),
_length(0),
! _print_sum(print_sum),
! _indent_level(indent_level),
! _thread_work_items(NULL),
! _enabled(true) {
assert(length > 0, "Must have some workers to store data for");
_length = length;
_data = NEW_C_HEAP_ARRAY(T, _length, mtGC);
reset();
}
--- 20,41 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
+ #ifndef SHARE_VM_GC_G1_WORKERDATAARRAY_INLINE_HPP
+ #define SHARE_VM_GC_G1_WORKERDATAARRAY_INLINE_HPP
+
#include "gc/g1/workerDataArray.hpp"
#include "memory/allocation.inline.hpp"
+ #include "utilities/ostream.hpp"
template <typename T>
! WorkerDataArray<T>::WorkerDataArray(uint length, const char* title) :
_title(title),
_length(0),
! _thread_work_items(NULL) {
assert(length > 0, "Must have some workers to store data for");
_length = length;
_data = NEW_C_HEAP_ARRAY(T, _length, mtGC);
reset();
}
*** 92,124 ****
}
return s;
}
template <typename T>
- T WorkerDataArray<T>::minimum(uint active_threads) const {
- T min = get(0);
- for (uint i = 1; i < active_threads; ++i) {
- min = MIN2(min, get(i));
- }
- return min;
- }
-
- template <typename T>
- T WorkerDataArray<T>::maximum(uint active_threads) const {
- T max = get(0);
- for (uint i = 1; i < active_threads; ++i) {
- max = MAX2(max, get(i));
- }
- return max;
- }
-
- template <typename T>
- T WorkerDataArray<T>::diff(uint active_threads) const {
- return maximum(active_threads) - minimum(active_threads);
- }
-
- template <typename T>
void WorkerDataArray<T>::clear() {
set_all(0);
}
template <typename T>
--- 90,99 ----
*** 126,135 ****
--- 101,131 ----
for (uint i = 0; i < _length; i++) {
_data[i] = value;
}
}
+ template <class T>
+ void WorkerDataArray<T>::print_summary_on(outputStream* out, uint active_threads, bool print_sum) const {
+ T max = get(0);
+ T min = max;
+ T sum = 0;
+ for (uint i = 1; i < active_threads; ++i) {
+ T value = get(i);
+ max = MAX2(max, value);
+ min = MIN2(min, value);
+ sum += value;
+ }
+ T diff = max - min;
+ double avg = sum / (double) active_threads;
+ WDAPrinter::summary(out, title(), min, avg, max, diff, sum, print_sum);
+ }
+
+ template <class T>
+ void WorkerDataArray<T>::print_details_on(outputStream* out, uint active_threads) const {
+ WDAPrinter::details(this, out, active_threads);
+ }
+
#ifndef PRODUCT
template <typename T>
void WorkerDataArray<T>::reset() {
set_all(uninitialized());
if (_thread_work_items != NULL) {
*** 137,150 ****
}
}
template <typename T>
void WorkerDataArray<T>::verify(uint active_threads) const {
- if (!_enabled) {
- return;
- }
-
assert(active_threads <= _length, "Wrong number of active threads");
for (uint i = 0; i < active_threads; i++) {
assert(_data[i] != uninitialized(),
"Invalid data for worker %u in '%s'", i, _title);
}
--- 133,142 ----
*** 161,165 ****
--- 153,159 ----
template <>
inline double WorkerDataArray<double>::uninitialized() const {
return -1.0;
}
#endif
+
+ #endif // SHARE_VM_GC_G1_WORKERDATAARRAY_INLINE_HPP
< prev index next >