Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/memory/metaspaceStats.hpp
40949 views
1
/*
2
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
3
* Copyright (c) 2021 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
#ifndef SHARE_MEMORY_METASPACESTATS_HPP
26
#define SHARE_MEMORY_METASPACESTATS_HPP
27
28
#include "utilities/globalDefinitions.hpp"
29
30
// Data holder classes for metaspace statistics.
31
//
32
// - MetaspaceStats: keeps reserved, committed and used byte counters;
33
// retrieve with MetaspaceUtils::get_statistics(MetadataType) for either class space
34
// or non-class space
35
//
36
// - MetaspaceCombinedStats: keeps reserved, committed and used byte counters, seperately for both class- and non-class-space;
37
// retrieve with MetaspaceUtils::get_combined_statistics()
38
39
// (Note: just for NMT these objects need to be mutable)
40
41
class MetaspaceStats {
42
size_t _reserved;
43
size_t _committed;
44
size_t _used;
45
public:
46
MetaspaceStats() : _reserved(0), _committed(0), _used(0) {}
47
MetaspaceStats(size_t r, size_t c, size_t u) : _reserved(r), _committed(c), _used(u) {}
48
size_t used() const { return _used; }
49
size_t committed() const { return _committed; }
50
size_t reserved() const { return _reserved; }
51
};
52
53
// Class holds combined statistics for both non-class and class space.
54
class MetaspaceCombinedStats : public MetaspaceStats {
55
MetaspaceStats _cstats; // class space stats
56
MetaspaceStats _ncstats; // non-class space stats
57
public:
58
MetaspaceCombinedStats() {}
59
MetaspaceCombinedStats(const MetaspaceStats& cstats, const MetaspaceStats& ncstats) :
60
MetaspaceStats(cstats.reserved() + ncstats.reserved(),
61
cstats.committed() + ncstats.committed(),
62
cstats.used() + ncstats.used()),
63
_cstats(cstats), _ncstats(ncstats)
64
{}
65
66
const MetaspaceStats& class_space_stats() const { return _cstats; }
67
const MetaspaceStats& non_class_space_stats() const { return _ncstats; }
68
size_t class_used() const { return _cstats.used(); }
69
size_t class_committed() const { return _cstats.committed(); }
70
size_t class_reserved() const { return _cstats.reserved(); }
71
size_t non_class_used() const { return _ncstats.used(); }
72
size_t non_class_committed() const { return _ncstats.committed(); }
73
size_t non_class_reserved() const { return _ncstats.reserved(); }
74
};
75
76
#endif // SHARE_MEMORY_METASPACESTATS_HPP
77
78