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 #ifndef SHARE_MEMORY_METASPACE_METASPACECOMMON_HPP_
26 #define SHARE_MEMORY_METASPACE_METASPACECOMMON_HPP_
27
28 #include "utilities/debug.hpp"
29 #include "utilities/globalDefinitions.hpp"
30
31 class outputStream;
32
33 namespace metaspace {
34 namespace internals {
35
36 enum ChunkSizes { // in words.
37 ClassSpecializedChunk = 128,
38 SpecializedChunk = 128,
39 ClassSmallChunk = 256,
40 SmallChunk = 512,
41 ClassMediumChunk = 4 * K,
42 MediumChunk = 8 * K
43 };
44
45 // Print a size, in words, scaled.
46 void print_scaled_words(outputStream* st, size_t word_size, size_t scale = 0, int width = -1);
47
48 // Convenience helper: prints a size value and a percentage.
49 void print_scaled_words_and_percentage(outputStream* st, size_t word_size, size_t compare_word_size, size_t scale = 0, int width = -1);
50
51 // Print a human readable size.
52 // byte_size: size, in bytes, to be printed.
53 // scale: one of 1 (byte-wise printing), sizeof(word) (word-size printing), K, M, G (scaled by KB, MB, GB respectively,
54 // or 0, which means the best scale is choosen dynamically.
105
106 // Utility functions.
107 size_t get_size_for_nonhumongous_chunktype(ChunkIndex chunk_type, bool is_class);
108 ChunkIndex get_chunk_type_by_size(size_t size, bool is_class);
109
110 ChunkIndex next_chunk_index(ChunkIndex i);
111 ChunkIndex prev_chunk_index(ChunkIndex i);
112 // Returns a descriptive name for a chunk type.
113 const char* chunk_size_name(ChunkIndex index);
114
115 // Verify chunk type.
116 inline bool is_valid_chunktype(ChunkIndex index) {
117 return index == SpecializedIndex || index == SmallIndex ||
118 index == MediumIndex || index == HumongousIndex;
119 }
120
121 inline bool is_valid_nonhumongous_chunktype(ChunkIndex index) {
122 return is_valid_chunktype(index) && index != HumongousIndex;
123 }
124
125
126
127
128 } // namespace internals
129 } // namespace metaspace
130
131 #endif /* SHARE_MEMORY_METASPACE_METASPACESTATISTICS_HPP_ */
|
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 #ifndef SHARE_MEMORY_METASPACE_METASPACECOMMON_HPP_
26 #define SHARE_MEMORY_METASPACE_METASPACECOMMON_HPP_
27
28 #include "utilities/debug.hpp"
29 #include "utilities/globalDefinitions.hpp"
30
31 class outputStream;
32
33 namespace metaspace {
34
35 enum ChunkSizes { // in words.
36 ClassSpecializedChunk = 128,
37 SpecializedChunk = 128,
38 ClassSmallChunk = 256,
39 SmallChunk = 512,
40 ClassMediumChunk = 4 * K,
41 MediumChunk = 8 * K
42 };
43
44 // Print a size, in words, scaled.
45 void print_scaled_words(outputStream* st, size_t word_size, size_t scale = 0, int width = -1);
46
47 // Convenience helper: prints a size value and a percentage.
48 void print_scaled_words_and_percentage(outputStream* st, size_t word_size, size_t compare_word_size, size_t scale = 0, int width = -1);
49
50 // Print a human readable size.
51 // byte_size: size, in bytes, to be printed.
52 // scale: one of 1 (byte-wise printing), sizeof(word) (word-size printing), K, M, G (scaled by KB, MB, GB respectively,
53 // or 0, which means the best scale is choosen dynamically.
104
105 // Utility functions.
106 size_t get_size_for_nonhumongous_chunktype(ChunkIndex chunk_type, bool is_class);
107 ChunkIndex get_chunk_type_by_size(size_t size, bool is_class);
108
109 ChunkIndex next_chunk_index(ChunkIndex i);
110 ChunkIndex prev_chunk_index(ChunkIndex i);
111 // Returns a descriptive name for a chunk type.
112 const char* chunk_size_name(ChunkIndex index);
113
114 // Verify chunk type.
115 inline bool is_valid_chunktype(ChunkIndex index) {
116 return index == SpecializedIndex || index == SmallIndex ||
117 index == MediumIndex || index == HumongousIndex;
118 }
119
120 inline bool is_valid_nonhumongous_chunktype(ChunkIndex index) {
121 return is_valid_chunktype(index) && index != HumongousIndex;
122 }
123
124 } // namespace metaspace
125
126 #endif /* SHARE_MEMORY_METASPACE_METASPACESTATISTICS_HPP_ */
127
|