< prev index next >

src/hotspot/share/services/nmtCommon.cpp

Print this page

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 #include "precompiled.hpp"
25 #include "services/nmtCommon.hpp"
26 #include "utilities/globalDefinitions.hpp"
27 
28 #define MEMORY_TYPE_DECLARE_NAME(type, human_readable) \
29   human_readable,
30 
31 STATIC_ASSERT(NMT_off > NMT_unknown);
32 STATIC_ASSERT(NMT_summary > NMT_off);
33 STATIC_ASSERT(NMT_detail > NMT_summary);
34 
35 const char* NMTUtil::_memory_type_names[] = {
36   MEMORY_TYPES_DO(MEMORY_TYPE_DECLARE_NAME)

37 };
38 
39 const char* NMTUtil::scale_name(size_t scale) {
40   switch(scale) {
41     case 1: return "";
42     case K: return "KB";
43     case M: return "MB";
44     case G: return "GB";
45   }
46   ShouldNotReachHere();
47   return NULL;
48 }
49 
50 size_t NMTUtil::scale_from_name(const char* scale) {
51   assert(scale != NULL, "Null pointer check");
52   if (strcasecmp(scale, "1") == 0 || strcasecmp(scale, "b") == 0) {
53     return 1;
54   } else if (strcasecmp(scale, "kb") == 0 || strcasecmp(scale, "k") == 0) {
55     return K;
56   } else if (strcasecmp(scale, "mb") == 0 || strcasecmp(scale, "m") == 0) {

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 #include "precompiled.hpp"
25 #include "services/nmtCommon.hpp"
26 #include "utilities/globalDefinitions.hpp"
27 
28 #define MEMORY_TYPE_DECLARE_NAME(type, human_readable) \
29   human_readable,
30 
31 STATIC_ASSERT(NMT_off > NMT_unknown);
32 STATIC_ASSERT(NMT_summary > NMT_off);
33 STATIC_ASSERT(NMT_detail > NMT_summary);
34 
35 const char* NMTUtil::_memory_type_names[] = {
36   MEMORY_TYPES_DO(MEMORY_TYPE_DECLARE_NAME)
37   "Value Types",
38 };
39 
40 const char* NMTUtil::scale_name(size_t scale) {
41   switch(scale) {
42     case 1: return "";
43     case K: return "KB";
44     case M: return "MB";
45     case G: return "GB";
46   }
47   ShouldNotReachHere();
48   return NULL;
49 }
50 
51 size_t NMTUtil::scale_from_name(const char* scale) {
52   assert(scale != NULL, "Null pointer check");
53   if (strcasecmp(scale, "1") == 0 || strcasecmp(scale, "b") == 0) {
54     return 1;
55   } else if (strcasecmp(scale, "kb") == 0 || strcasecmp(scale, "k") == 0) {
56     return K;
57   } else if (strcasecmp(scale, "mb") == 0 || strcasecmp(scale, "m") == 0) {
< prev index next >