author | kbarrett |
Tue, 30 Aug 2016 23:48:16 -0400 | |
changeset 40892 | 330a02d935ad |
parent 37214 | bc4e0e0995e6 |
child 42058 | 46e3b28fda3b |
permissions | -rw-r--r-- |
33623 | 1 |
/* |
37214
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
2 |
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
33623 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
25 |
#include "precompiled.hpp" |
|
26 |
#include "gc/g1/workerDataArray.inline.hpp" |
|
36374 | 27 |
#include "utilities/ostream.hpp" |
28 |
||
29 |
template <> |
|
37214
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
30 |
size_t WorkerDataArray<size_t>::uninitialized() { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
31 |
return (size_t)-1; |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
32 |
} |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
33 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
34 |
template <> |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
35 |
double WorkerDataArray<double>::uninitialized() { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
36 |
return -1.0; |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
37 |
} |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
38 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
39 |
template <> |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
40 |
void WorkerDataArray<double>::WDAPrinter::summary(outputStream* out, double min, double avg, double max, double diff, double sum, bool print_sum) { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
41 |
out->print(" Min: %4.1lf, Avg: %4.1lf, Max: %4.1lf, Diff: %4.1lf", min * MILLIUNITS, avg * MILLIUNITS, max * MILLIUNITS, diff* MILLIUNITS); |
36374 | 42 |
if (print_sum) { |
37214
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
43 |
out->print(", Sum: %4.1lf", sum * MILLIUNITS); |
36374 | 44 |
} |
45 |
} |
|
46 |
||
47 |
template <> |
|
37214
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
48 |
void WorkerDataArray<size_t>::WDAPrinter::summary(outputStream* out, size_t min, double avg, size_t max, size_t diff, size_t sum, bool print_sum) { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
49 |
out->print(" Min: " SIZE_FORMAT ", Avg: %4.1lf, Max: " SIZE_FORMAT ", Diff: " SIZE_FORMAT, min, avg, max, diff); |
36374 | 50 |
if (print_sum) { |
37214
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
51 |
out->print(", Sum: " SIZE_FORMAT, sum); |
36374 | 52 |
} |
53 |
} |
|
54 |
||
55 |
template <> |
|
37214
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
56 |
void WorkerDataArray<double>::WDAPrinter::details(const WorkerDataArray<double>* phase, outputStream* out) { |
36374 | 57 |
out->print("%-25s", ""); |
37214
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
58 |
for (uint i = 0; i < phase->_length; ++i) { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
59 |
double value = phase->get(i); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
60 |
if (value != phase->uninitialized()) { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
61 |
out->print(" %4.1lf", phase->get(i) * 1000.0); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
62 |
} else { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
63 |
out->print(" -"); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
64 |
} |
36374 | 65 |
} |
66 |
out->cr(); |
|
67 |
} |
|
68 |
||
69 |
template <> |
|
37214
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
70 |
void WorkerDataArray<size_t>::WDAPrinter::details(const WorkerDataArray<size_t>* phase, outputStream* out) { |
36374 | 71 |
out->print("%-25s", ""); |
37214
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
72 |
for (uint i = 0; i < phase->_length; ++i) { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
73 |
size_t value = phase->get(i); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
74 |
if (value != phase->uninitialized()) { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
75 |
out->print(" " SIZE_FORMAT, phase->get(i)); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
76 |
} else { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
77 |
out->print(" -"); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
78 |
} |
36374 | 79 |
} |
80 |
out->cr(); |
|
81 |
} |
|
33623 | 82 |
|
83 |
#ifndef PRODUCT |
|
37214
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
84 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
85 |
#include "memory/resourceArea.hpp" |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
86 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
87 |
void WorkerDataArray_test_verify_string(const char* expected_string, const char* actual_string) { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
88 |
const size_t expected_len = strlen(expected_string); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
89 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
90 |
assert(expected_len == strlen(actual_string), |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
91 |
"Wrong string length, expected " SIZE_FORMAT " but got " SIZE_FORMAT "(Expected '%s' but got: '%s')", |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
92 |
expected_len, strlen(actual_string), expected_string, actual_string); |
33623 | 93 |
|
37214
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
94 |
// Can't use strncmp here because floating point values use different decimal points for different locales. |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
95 |
// Allow strings to differ in "." vs. "," only. This should still catch most errors. |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
96 |
for (size_t i = 0; i < expected_len; i++) { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
97 |
char e = expected_string[i]; |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
98 |
char a = actual_string[i]; |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
99 |
if (e != a) { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
100 |
if ((e == '.' || e == ',') && (a == '.' || a == ',')) { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
101 |
// Most likely just a difference in locale |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
102 |
} else { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
103 |
assert(false, "Expected '%s' but got: '%s'", expected_string, actual_string); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
104 |
} |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
105 |
} |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
106 |
} |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
107 |
} |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
108 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
109 |
void WorkerDataArray_test_verify_array(WorkerDataArray<size_t>& array, size_t expected_sum, double expected_avg, const char* expected_summary, const char* exected_details) { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
110 |
const double epsilon = 0.0001; |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
111 |
assert(array.sum() == expected_sum, "Wrong sum, expected: " SIZE_FORMAT " but got: " SIZE_FORMAT, expected_sum, array.sum()); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
112 |
assert(fabs(array.average() - expected_avg) < epsilon, "Wrong average, expected: %f but got: %f", expected_avg, array.average()); |
33623 | 113 |
|
37214
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
114 |
ResourceMark rm; |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
115 |
stringStream out; |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
116 |
array.print_summary_on(&out); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
117 |
WorkerDataArray_test_verify_string(expected_summary, out.as_string()); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
118 |
out.reset(); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
119 |
array.print_details_on(&out); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
120 |
WorkerDataArray_test_verify_string(exected_details, out.as_string()); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
121 |
} |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
122 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
123 |
void WorkerDataArray_test_verify_array(WorkerDataArray<double>& array, double expected_sum, double expected_avg, const char* expected_summary, const char* exected_details) { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
124 |
const double epsilon = 0.0001; |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
125 |
assert(fabs(array.sum() - expected_sum) < epsilon, "Wrong sum, expected: %f but got: %f", expected_sum, array.sum()); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
126 |
assert(fabs(array.average() - expected_avg) < epsilon, "Wrong average, expected: %f but got: %f", expected_avg, array.average()); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
127 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
128 |
ResourceMark rm; |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
129 |
stringStream out; |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
130 |
array.print_summary_on(&out); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
131 |
WorkerDataArray_test_verify_string(expected_summary, out.as_string()); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
132 |
out.reset(); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
133 |
array.print_details_on(&out); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
134 |
WorkerDataArray_test_verify_string(exected_details, out.as_string()); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
135 |
} |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
136 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
137 |
void WorkerDataArray_test_basic() { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
138 |
WorkerDataArray<size_t> array(3, "Test array"); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
139 |
array.set(0, 5); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
140 |
array.set(1, 3); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
141 |
array.set(2, 7); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
142 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
143 |
WorkerDataArray_test_verify_array(array, 15, 5.0, |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
144 |
"Test array Min: 3, Avg: 5.0, Max: 7, Diff: 4, Sum: 15, Workers: 3\n", |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
145 |
" 5 3 7\n" ); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
146 |
} |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
147 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
148 |
void WorkerDataArray_test_add() { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
149 |
WorkerDataArray<size_t> array(3, "Test array"); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
150 |
array.set(0, 5); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
151 |
array.set(1, 3); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
152 |
array.set(2, 7); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
153 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
154 |
for (uint i = 0; i < 3; i++) { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
155 |
array.add(i, 1); |
33623 | 156 |
} |
157 |
||
37214
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
158 |
WorkerDataArray_test_verify_array(array, 18, 6.0, |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
159 |
"Test array Min: 4, Avg: 6.0, Max: 8, Diff: 4, Sum: 18, Workers: 3\n", |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
160 |
" 6 4 8\n" ); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
161 |
} |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
162 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
163 |
void WorkerDataArray_test_with_uninitialized() { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
164 |
WorkerDataArray<size_t> array(3, "Test array"); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
165 |
array.set(0, 5); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
166 |
array.set(1, WorkerDataArray<size_t>::uninitialized()); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
167 |
array.set(2, 7); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
168 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
169 |
WorkerDataArray_test_verify_array(array, 12, 6, |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
170 |
"Test array Min: 5, Avg: 6.0, Max: 7, Diff: 2, Sum: 12, Workers: 2\n", |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
171 |
" 5 - 7\n" ); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
172 |
} |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
173 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
174 |
void WorkerDataArray_test_uninitialized() { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
175 |
WorkerDataArray<size_t> array(3, "Test array"); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
176 |
array.set(0, WorkerDataArray<size_t>::uninitialized()); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
177 |
array.set(1, WorkerDataArray<size_t>::uninitialized()); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
178 |
array.set(2, WorkerDataArray<size_t>::uninitialized()); |
33623 | 179 |
|
37214
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
180 |
WorkerDataArray_test_verify_array(array, 0, 0.0, |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
181 |
"Test array skipped\n", |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
182 |
" - - -\n" ); |
33623 | 183 |
} |
37214
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
184 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
185 |
void WorkerDataArray_test_double_with_uninitialized() { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
186 |
WorkerDataArray<double> array(3, "Test array"); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
187 |
array.set(0, 5.1 / MILLIUNITS); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
188 |
array.set(1, WorkerDataArray<double>::uninitialized()); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
189 |
array.set(2, 7.2 / MILLIUNITS); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
190 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
191 |
WorkerDataArray_test_verify_array(array, 12.3 / MILLIUNITS, 6.15 / MILLIUNITS, |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
192 |
"Test array Min: 5.1, Avg: 6.1, Max: 7.2, Diff: 2.1, Sum: 12.3, Workers: 2\n", |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
193 |
" 5.1 - 7.2\n" ); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
194 |
} |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
195 |
|
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
196 |
void WorkerDataArray_test() { |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
197 |
WorkerDataArray_test_basic(); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
198 |
WorkerDataArray_test_add(); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
199 |
WorkerDataArray_test_with_uninitialized(); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
200 |
WorkerDataArray_test_uninitialized(); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
201 |
WorkerDataArray_test_double_with_uninitialized(); |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
202 |
} |
bc4e0e0995e6
8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents:
36374
diff
changeset
|
203 |
|
33623 | 204 |
#endif |