< prev index next >

src/hotspot/share/memory/metaspace/metaspaceCommon.hpp

Print this page

 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_METASPACECOMMON_HPP
 27 #define SHARE_MEMORY_METASPACE_METASPACECOMMON_HPP
 28 
 29 #include "runtime/globals.hpp"
 30 #include "utilities/align.hpp"
 31 #include "utilities/debug.hpp"
 32 #include "utilities/globalDefinitions.hpp"
 33 
 34 class outputStream;
 35 
 36 namespace metaspace {
 37 
 38 // Metaspace allocation alignment:
 39 
 40 // 1) Metaspace allocations have to be aligned such that 64bit values are aligned
 41 //  correctly.
 42 //
 43 // 2) Klass* structures allocated from Metaspace have to be aligned to KlassAlignmentInBytes.
 44 //
 45 // At the moment LogKlassAlignmentInBytes is 3, so KlassAlignmentInBytes == 8,
 46 //  so (1) and (2) can both be fulfilled with an alignment of 8. Should we increase
 47 //  KlassAlignmentInBytes at any time this will increase the necessary alignment as well. In
 48 //  that case we may think about introducing a separate alignment just for the class space
 49 //  since that alignment would only be needed for Klass structures.
 50 
 51 static const size_t AllocationAlignmentByteSize = 8;
 52 STATIC_ASSERT(AllocationAlignmentByteSize == (size_t)KlassAlignmentInBytes);
 53 
 54 static const size_t AllocationAlignmentWordSize = AllocationAlignmentByteSize / BytesPerWord;
 55 
 56 // Returns the raw word size allocated for a given net allocation
 57 size_t get_raw_word_size_for_requested_word_size(size_t word_size);
 58 
 59 // Utility functions
 60 
 61 // Print a size, in words, scaled.
 62 void print_scaled_words(outputStream* st, size_t word_size, size_t scale = 0, int width = -1);
 63 
 64 // Convenience helper: prints a size value and a percentage.
 65 void print_scaled_words_and_percentage(outputStream* st, size_t word_size, size_t compare_word_size, size_t scale = 0, int width = -1);
 66 
 67 // Print a human readable size.
 68 // byte_size: size, in bytes, to be printed.
 69 // scale: one of 1 (byte-wise printing), sizeof(word) (word-size printing), K, M, G (scaled by KB, MB, GB respectively,
 70 //         or 0, which means the best scale is chosen dynamically.
 71 // width: printing width.
 72 void print_human_readable_size(outputStream* st, size_t byte_size, size_t scale = 0, int width = -1);
 73 
 74 // Prints a percentage value. Values smaller than 1% but not 0 are displayed as "<1%", values
 75 // larger than 99% but not 100% are displayed as ">100%".
 76 void print_percentage(outputStream* st, size_t total, size_t part);
 77 
 78 #ifdef ASSERT

 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_METASPACECOMMON_HPP
 27 #define SHARE_MEMORY_METASPACE_METASPACECOMMON_HPP
 28 
 29 #include "runtime/globals.hpp"
 30 #include "utilities/align.hpp"
 31 #include "utilities/debug.hpp"
 32 #include "utilities/globalDefinitions.hpp"
 33 
 34 class outputStream;
 35 
 36 namespace metaspace {
 37 





















 38 // Utility functions
 39 
 40 // Print a size, in words, scaled.
 41 void print_scaled_words(outputStream* st, size_t word_size, size_t scale = 0, int width = -1);
 42 
 43 // Convenience helper: prints a size value and a percentage.
 44 void print_scaled_words_and_percentage(outputStream* st, size_t word_size, size_t compare_word_size, size_t scale = 0, int width = -1);
 45 
 46 // Print a human readable size.
 47 // byte_size: size, in bytes, to be printed.
 48 // scale: one of 1 (byte-wise printing), sizeof(word) (word-size printing), K, M, G (scaled by KB, MB, GB respectively,
 49 //         or 0, which means the best scale is chosen dynamically.
 50 // width: printing width.
 51 void print_human_readable_size(outputStream* st, size_t byte_size, size_t scale = 0, int width = -1);
 52 
 53 // Prints a percentage value. Values smaller than 1% but not 0 are displayed as "<1%", values
 54 // larger than 99% but not 100% are displayed as ">100%".
 55 void print_percentage(outputStream* st, size_t total, size_t part);
 56 
 57 #ifdef ASSERT
< prev index next >