src/hotspot/share/services/nmtCommon.cpp
changeset 49980 57dd7b4ba338
parent 47216 71c04702a3d5
child 51264 cf34c71ca27c
--- a/src/hotspot/share/services/nmtCommon.cpp	Thu May 03 17:36:25 2018 -0700
+++ b/src/hotspot/share/services/nmtCommon.cpp	Tue Apr 24 18:06:32 2018 +0200
@@ -23,6 +23,7 @@
  */
 #include "precompiled.hpp"
 #include "services/nmtCommon.hpp"
+#include "utilities/globalDefinitions.hpp"
 
 const char* NMTUtil::_memory_type_names[] = {
   "Java Heap",
@@ -59,14 +60,13 @@
 
 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