author | stuefe |
Tue, 26 Nov 2019 16:21:29 +0100 | |
branch | stuefe-new-metaspace-branch |
changeset 59272 | 54750b448264 |
parent 58063 | bdf136b8ae0e |
permissions | -rw-r--r-- |
49980 | 1 |
/* |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
54820
diff
changeset
|
2 |
* Copyright (c) 2018, 2019, SAP SE. All rights reserved. |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50193
diff
changeset
|
3 |
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. |
49980 | 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 |
||
50193 | 26 |
#ifndef SHARE_MEMORY_METASPACE_METASPACECOMMON_HPP |
27 |
#define SHARE_MEMORY_METASPACE_METASPACECOMMON_HPP |
|
49980 | 28 |
|
53970 | 29 |
#include "utilities/align.hpp" |
50193 | 30 |
#include "utilities/debug.hpp" |
49980 | 31 |
#include "utilities/globalDefinitions.hpp" |
32 |
||
33 |
class outputStream; |
|
34 |
||
35 |
namespace metaspace { |
|
50193 | 36 |
|
49980 | 37 |
|
38 |
// Print a size, in words, scaled. |
|
39 |
void print_scaled_words(outputStream* st, size_t word_size, size_t scale = 0, int width = -1); |
|
40 |
||
41 |
// Convenience helper: prints a size value and a percentage. |
|
42 |
void print_scaled_words_and_percentage(outputStream* st, size_t word_size, size_t compare_word_size, size_t scale = 0, int width = -1); |
|
43 |
||
44 |
// Print a human readable size. |
|
45 |
// byte_size: size, in bytes, to be printed. |
|
46 |
// scale: one of 1 (byte-wise printing), sizeof(word) (word-size printing), K, M, G (scaled by KB, MB, GB respectively, |
|
47 |
// or 0, which means the best scale is choosen dynamically. |
|
48 |
// width: printing width. |
|
49 |
void print_human_readable_size(outputStream* st, size_t byte_size, size_t scale = 0, int width = -1); |
|
50 |
||
51 |
// Prints a percentage value. Values smaller than 1% but not 0 are displayed as "<1%", values |
|
52 |
// larger than 99% but not 100% are displayed as ">100%". |
|
53 |
void print_percentage(outputStream* st, size_t total, size_t part); |
|
54 |
||
50193 | 55 |
|
56 |
#define assert_is_aligned(value, alignment) \ |
|
57 |
assert(is_aligned((value), (alignment)), \ |
|
58 |
SIZE_FORMAT_HEX " is not aligned to " \ |
|
59 |
SIZE_FORMAT, (size_t)(uintptr_t)value, (alignment)) |
|
60 |
||
61 |
||
54820 | 62 |
// Pretty printing helpers |
63 |
const char* classes_plural(uintx num); |
|
64 |
const char* loaders_plural(uintx num); |
|
65 |
void print_number_of_classes(outputStream* out, uintx classes, uintx classes_shared); |
|
66 |
||
49980 | 67 |
} // namespace metaspace |
68 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50193
diff
changeset
|
69 |
#endif // SHARE_MEMORY_METASPACE_METASPACECOMMON_HPP |