Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/memory/metaspace/metaspaceStatistics.hpp
40957 views
1
/*
2
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
3
* Copyright (c) 2018, 2020 SAP SE. All rights reserved.
4
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
*
6
* This code is free software; you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License version 2 only, as
8
* published by the Free Software Foundation.
9
*
10
* This code is distributed in the hope that it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13
* version 2 for more details (a copy is included in the LICENSE file that
14
* accompanied this code).
15
*
16
* You should have received a copy of the GNU General Public License version
17
* 2 along with this work; if not, write to the Free Software Foundation,
18
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
*
20
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21
* or visit www.oracle.com if you need additional information or have any
22
* questions.
23
*
24
*/
25
26
#ifndef SHARE_MEMORY_METASPACE_METASPACESTATISTICS_HPP
27
#define SHARE_MEMORY_METASPACE_METASPACESTATISTICS_HPP
28
29
#include "memory/metaspace.hpp" // for MetadataType enum
30
#include "memory/metaspace/chunklevel.hpp"
31
#include "utilities/globalDefinitions.hpp"
32
33
class outputStream;
34
35
namespace metaspace {
36
37
// Contains a number of data output structures:
38
//
39
// - cm_stats_t
40
// - clms_stats_t -> arena_stats_t -> in_use_chunk_stats_t
41
//
42
// used for the various XXXX::add_to_statistic() methods in MetaspaceArena, ClassLoaderMetaspace
43
// and ChunkManager, respectively.
44
45
struct ChunkManagerStats {
46
47
// How many chunks per level are checked in.
48
int _num_chunks[chunklevel::NUM_CHUNK_LEVELS];
49
50
// Size, in words, of the sum of all committed areas in this chunk manager, per level.
51
size_t _committed_word_size[chunklevel::NUM_CHUNK_LEVELS];
52
53
ChunkManagerStats() : _num_chunks(), _committed_word_size() {}
54
55
void add(const ChunkManagerStats& other);
56
57
// Returns total word size of all chunks in this manager.
58
size_t total_word_size() const;
59
60
// Returns total committed word size of all chunks in this manager.
61
size_t total_committed_word_size() const;
62
63
void print_on(outputStream* st, size_t scale) const;
64
65
DEBUG_ONLY(void verify() const;)
66
67
};
68
69
// Contains statistics for one or multiple chunks in use.
70
struct InUseChunkStats {
71
72
// Number of chunks
73
int _num;
74
75
// Note:
76
// capacity = committed + uncommitted
77
// committed = used + free + waste
78
79
// Capacity (total sum of all chunk sizes) in words.
80
// May contain committed and uncommitted space.
81
size_t _word_size;
82
83
// Total committed area, in words.
84
size_t _committed_words;
85
86
// Total used area, in words.
87
size_t _used_words;
88
89
// Total free committed area, in words.
90
size_t _free_words;
91
92
// Total waste committed area, in words.
93
size_t _waste_words;
94
95
InUseChunkStats() :
96
_num(0),
97
_word_size(0),
98
_committed_words(0),
99
_used_words(0),
100
_free_words(0),
101
_waste_words(0)
102
{}
103
104
void add(const InUseChunkStats& other) {
105
_num += other._num;
106
_word_size += other._word_size;
107
_committed_words += other._committed_words;
108
_used_words += other._used_words;
109
_free_words += other._free_words;
110
_waste_words += other._waste_words;
111
112
}
113
114
void print_on(outputStream* st, size_t scale) const;
115
116
DEBUG_ONLY(void verify() const;)
117
118
};
119
120
// Class containing statistics for one or more MetaspaceArena objects.
121
struct ArenaStats {
122
123
// chunk statistics by chunk level
124
InUseChunkStats _stats[chunklevel::NUM_CHUNK_LEVELS];
125
uintx _free_blocks_num;
126
size_t _free_blocks_word_size;
127
128
ArenaStats() :
129
_stats(),
130
_free_blocks_num(0),
131
_free_blocks_word_size(0)
132
{}
133
134
void add(const ArenaStats& other);
135
136
void print_on(outputStream* st, size_t scale = K, bool detailed = true) const;
137
138
InUseChunkStats totals() const;
139
140
DEBUG_ONLY(void verify() const;)
141
142
};
143
144
// Statistics for one or multiple ClassLoaderMetaspace objects
145
struct ClmsStats {
146
147
ArenaStats _arena_stats_nonclass;
148
ArenaStats _arena_stats_class;
149
150
ClmsStats() : _arena_stats_nonclass(), _arena_stats_class() {}
151
152
void add(const ClmsStats& other) {
153
_arena_stats_nonclass.add(other._arena_stats_nonclass);
154
_arena_stats_class.add(other._arena_stats_class);
155
}
156
157
void print_on(outputStream* st, size_t scale, bool detailed) const;
158
159
// Returns total statistics for both class and non-class metaspace
160
ArenaStats totals() const;
161
162
DEBUG_ONLY(void verify() const;)
163
164
};
165
166
} // namespace metaspace
167
168
#endif // SHARE_MEMORY_METASPACE_METASPACESTATISTICS_HPP
169
170
171