author | sangheki |
Wed, 13 Nov 2019 10:51:41 -0800 | |
changeset 59062 | 6530de931b8e |
permissions | -rw-r--r-- |
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
1 |
/* |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
2 |
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
4 |
* |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
8 |
* |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
13 |
* accompanied this code). |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
14 |
* |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
18 |
* |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
21 |
* questions. |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
22 |
* |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
23 |
*/ |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
24 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
26 |
#include "gc/g1/g1NUMAStats.hpp" |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
27 |
#include "logging/logStream.hpp" |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
28 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
29 |
double G1NUMAStats::Stat::rate() const { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
30 |
return _requested == 0 ? 0 : (double)_hit / _requested * 100; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
31 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
32 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
33 |
G1NUMAStats::NodeDataArray::NodeDataArray(uint num_nodes) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
34 |
guarantee(num_nodes > 1, "Number of nodes (%u) should be set", num_nodes); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
35 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
36 |
// The row represents the number of nodes. |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
37 |
_num_column = num_nodes; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
38 |
// +1 for G1MemoryNodeManager::AnyNodeIndex. |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
39 |
_num_row = num_nodes + 1; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
40 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
41 |
_data = NEW_C_HEAP_ARRAY(size_t*, _num_row, mtGC); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
42 |
for (uint row = 0; row < _num_row; row++) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
43 |
_data[row] = NEW_C_HEAP_ARRAY(size_t, _num_column, mtGC); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
44 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
45 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
46 |
clear(); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
47 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
48 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
49 |
G1NUMAStats::NodeDataArray::~NodeDataArray() { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
50 |
for (uint row = 0; row < _num_row; row++) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
51 |
FREE_C_HEAP_ARRAY(size_t, _data[row]); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
52 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
53 |
FREE_C_HEAP_ARRAY(size_t*, _data); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
54 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
55 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
56 |
void G1NUMAStats::NodeDataArray::create_hit_rate(Stat* result) const { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
57 |
size_t requested = 0; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
58 |
size_t hit = 0; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
59 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
60 |
for (size_t row = 0; row < _num_row; row++) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
61 |
for (size_t column = 0; column < _num_column; column++) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
62 |
requested += _data[row][column]; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
63 |
if (row == column) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
64 |
hit += _data[row][column]; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
65 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
66 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
67 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
68 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
69 |
assert(result != NULL, "Invariant"); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
70 |
result->_hit = hit; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
71 |
result->_requested = requested; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
72 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
73 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
74 |
void G1NUMAStats::NodeDataArray::create_hit_rate(Stat* result, uint req_index) const { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
75 |
size_t requested = 0; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
76 |
size_t hit = _data[req_index][req_index]; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
77 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
78 |
for (size_t column = 0; column < _num_column; column++) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
79 |
requested += _data[req_index][column]; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
80 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
81 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
82 |
assert(result != NULL, "Invariant"); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
83 |
result->_hit = hit; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
84 |
result->_requested = requested; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
85 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
86 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
87 |
size_t G1NUMAStats::NodeDataArray::sum(uint req_index) const { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
88 |
size_t sum = 0; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
89 |
for (size_t column = 0; column < _num_column; column++) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
90 |
sum += _data[req_index][column]; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
91 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
92 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
93 |
return sum; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
94 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
95 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
96 |
void G1NUMAStats::NodeDataArray::increase(uint req_index, uint alloc_index) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
97 |
assert(req_index < _num_row, |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
98 |
"Requested index %u should be less than the row size %u", |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
99 |
req_index, _num_row); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
100 |
assert(alloc_index < _num_column, |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
101 |
"Allocated index %u should be less than the column size %u", |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
102 |
alloc_index, _num_column); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
103 |
_data[req_index][alloc_index] += 1; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
104 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
105 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
106 |
void G1NUMAStats::NodeDataArray::clear() { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
107 |
for (uint row = 0; row < _num_row; row++) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
108 |
memset((void*)_data[row], 0, sizeof(size_t) * _num_column); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
109 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
110 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
111 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
112 |
size_t G1NUMAStats::NodeDataArray::get(uint req_index, uint alloc_index) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
113 |
return _data[req_index][alloc_index]; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
114 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
115 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
116 |
void G1NUMAStats::NodeDataArray::copy(uint req_index, size_t* stat) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
117 |
assert(stat != NULL, "Invariant"); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
118 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
119 |
for (uint column = 0; column < _num_column; column++) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
120 |
_data[req_index][column] += stat[column]; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
121 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
122 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
123 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
124 |
G1NUMAStats::G1NUMAStats(const int* node_ids, uint num_node_ids) : |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
125 |
_node_ids(node_ids), _num_node_ids(num_node_ids), _node_data() { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
126 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
127 |
assert(_num_node_ids > 1, "Should have more than one active memory nodes %u", _num_node_ids); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
128 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
129 |
for (int i = 0; i < NodeDataItemsSentinel; i++) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
130 |
_node_data[i] = new NodeDataArray(_num_node_ids); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
131 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
132 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
133 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
134 |
G1NUMAStats::~G1NUMAStats() { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
135 |
for (int i = 0; i < NodeDataItemsSentinel; i++) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
136 |
delete _node_data[i]; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
137 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
138 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
139 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
140 |
void G1NUMAStats::clear(G1NUMAStats::NodeDataItems phase) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
141 |
_node_data[phase]->clear(); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
142 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
143 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
144 |
void G1NUMAStats::update(G1NUMAStats::NodeDataItems phase, |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
145 |
uint requested_node_index, |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
146 |
uint allocated_node_index) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
147 |
_node_data[phase]->increase(requested_node_index, allocated_node_index); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
148 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
149 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
150 |
void G1NUMAStats::copy(G1NUMAStats::NodeDataItems phase, |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
151 |
uint requested_node_index, |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
152 |
size_t* allocated_stat) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
153 |
_node_data[phase]->copy(requested_node_index, allocated_stat); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
154 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
155 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
156 |
static const char* phase_to_explanatory_string(G1NUMAStats::NodeDataItems phase) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
157 |
switch(phase) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
158 |
case G1NUMAStats::NewRegionAlloc: |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
159 |
return "Placement match ratio"; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
160 |
case G1NUMAStats::LocalObjProcessAtCopyToSurv: |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
161 |
return "Worker task locality match ratio"; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
162 |
default: |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
163 |
return ""; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
164 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
165 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
166 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
167 |
#define RATE_TOTAL_FORMAT "%0.0f%% " SIZE_FORMAT "/" SIZE_FORMAT |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
168 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
169 |
void G1NUMAStats::print_info(G1NUMAStats::NodeDataItems phase) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
170 |
LogTarget(Info, gc, heap, numa) lt; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
171 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
172 |
if (lt.is_enabled()) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
173 |
LogStream ls(lt); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
174 |
Stat result; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
175 |
size_t array_width = _num_node_ids; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
176 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
177 |
_node_data[phase]->create_hit_rate(&result); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
178 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
179 |
ls.print("%s: " RATE_TOTAL_FORMAT " (", |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
180 |
phase_to_explanatory_string(phase), result.rate(), result._hit, result._requested); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
181 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
182 |
for (uint i = 0; i < array_width; i++) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
183 |
if (i != 0) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
184 |
ls.print(", "); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
185 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
186 |
_node_data[phase]->create_hit_rate(&result, i); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
187 |
ls.print("%d: " RATE_TOTAL_FORMAT, |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
188 |
_node_ids[i], result.rate(), result._hit, result._requested); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
189 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
190 |
ls.print_cr(")"); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
191 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
192 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
193 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
194 |
void G1NUMAStats::print_mutator_alloc_stat_debug() { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
195 |
LogTarget(Debug, gc, heap, numa) lt; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
196 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
197 |
if (lt.is_enabled()) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
198 |
LogStream ls(lt); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
199 |
uint array_width = _num_node_ids; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
200 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
201 |
ls.print("Allocated NUMA ids "); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
202 |
for (uint i = 0; i < array_width; i++) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
203 |
ls.print("%8d", _node_ids[i]); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
204 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
205 |
ls.print_cr(" Total"); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
206 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
207 |
ls.print("Requested NUMA id "); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
208 |
for (uint req = 0; req < array_width; req++) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
209 |
ls.print("%3d ", _node_ids[req]); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
210 |
for (uint alloc = 0; alloc < array_width; alloc++) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
211 |
ls.print(SIZE_FORMAT_W(8), _node_data[NewRegionAlloc]->get(req, alloc)); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
212 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
213 |
ls.print(SIZE_FORMAT_W(8), _node_data[NewRegionAlloc]->sum(req)); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
214 |
ls.print_cr(""); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
215 |
// Add padding to align with the string 'Requested NUMA id'. |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
216 |
ls.print(" "); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
217 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
218 |
ls.print("Any "); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
219 |
for (uint alloc = 0; alloc < array_width; alloc++) { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
220 |
ls.print(SIZE_FORMAT_W(8), _node_data[NewRegionAlloc]->get(array_width, alloc)); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
221 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
222 |
ls.print(SIZE_FORMAT_W(8), _node_data[NewRegionAlloc]->sum(array_width)); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
223 |
ls.print_cr(""); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
224 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
225 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
226 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
227 |
void G1NUMAStats::print_statistics() { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
228 |
print_info(NewRegionAlloc); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
229 |
print_mutator_alloc_stat_debug(); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
230 |
|
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
231 |
print_info(LocalObjProcessAtCopyToSurv); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff
changeset
|
232 |
} |