1 /*
 2  * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
 3  * Copyright (c) 2020, 2022 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_RUNNINGCOUNTERS_HPP
27 #define SHARE_MEMORY_METASPACE_RUNNINGCOUNTERS_HPP
28 
29 #include "memory/allStatic.hpp"
30 
31 namespace metaspace {
32 
33 // This class is a convenience interface for accessing global metaspace counters.
34 struct RunningCounters : public AllStatic {
35 
36   // ---- virtual memory -----
37 
38   // Return reserved size, in words, for Metaspace
39   static size_t reserved_words();
40   static size_t reserved_words_class();
41   static size_t reserved_words_nonclass();
42 
43   // Return total committed size, in words, for Metaspace
44   static size_t committed_words();
45   static size_t committed_words_class();
46   static size_t committed_words_nonclass();
47 
48   // ---- used chunks -----
49 
50   // Returns size, in words, used for metadata.
51   static size_t used_words();
52   static size_t used_words_class();
53   static size_t used_words_nonclass();
54 
55   // ---- free chunks -----
56 
57   // Returns size, in words, of all chunks in all freelists.
58   static size_t free_chunks_words();
59   static size_t free_chunks_words_class();
60   static size_t free_chunks_words_nonclass();
61 
62 };
63 
64 } // namespace metaspace
65 
66 #endif // SHARE_MEMORY_METASPACE_RUNNINGCOUNTERS_HPP