< prev index next >
src/hotspot/share/services/nmtCommon.cpp
Print this page
rev 49870 : 8201572: Improve Metaspace reporting
Reviewed-by:
@@ -21,10 +21,11 @@
* questions.
*
*/
#include "precompiled.hpp"
#include "services/nmtCommon.hpp"
+#include "utilities/globalDefinitions.hpp"
const char* NMTUtil::_memory_type_names[] = {
"Java Heap",
"Class",
"Thread",
@@ -57,18 +58,17 @@
return NULL;
}
size_t NMTUtil::scale_from_name(const char* scale) {
assert(scale != NULL, "Null pointer check");
- if (strncmp(scale, "KB", 2) == 0 ||
- strncmp(scale, "kb", 2) == 0) {
+ if (strcasecmp(scale, "1") == 0 || strcasecmp(scale, "b") == 0) {
+ return 1;
+ } else if (strcasecmp(scale, "kb") == 0 || strcasecmp(scale, "k") == 0) {
return K;
- } else if (strncmp(scale, "MB", 2) == 0 ||
- strncmp(scale, "mb", 2) == 0) {
+ } else if (strcasecmp(scale, "mb") == 0 || strcasecmp(scale, "m") == 0) {
return M;
- } else if (strncmp(scale, "GB", 2) == 0 ||
- strncmp(scale, "gb", 2) == 0) {
+ } else if (strcasecmp(scale, "gb") == 0 || strcasecmp(scale, "g") == 0) {
return G;
} else {
return 0; // Invalid value
}
return K;
< prev index next >