author | stuefe |
Tue, 24 Apr 2018 18:06:32 +0200 | |
changeset 49980 | 57dd7b4ba338 |
parent 47216 | 71c04702a3d5 |
child 51264 | cf34c71ca27c |
permissions | -rw-r--r-- |
25946 | 1 |
/* |
38733 | 2 |
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. |
25946 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
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" |
|
49980 | 26 |
#include "utilities/globalDefinitions.hpp" |
25946 | 27 |
|
28 |
const char* NMTUtil::_memory_type_names[] = { |
|
29 |
"Java Heap", |
|
30 |
"Class", |
|
31 |
"Thread", |
|
32 |
"Thread Stack", |
|
33 |
"Code", |
|
34 |
"GC", |
|
35 |
"Compiler", |
|
36 |
"Internal", |
|
37 |
"Other", |
|
38 |
"Symbol", |
|
39 |
"Native Memory Tracking", |
|
40 |
"Shared class space", |
|
41 |
"Arena Chunk", |
|
42 |
"Test", |
|
43 |
"Tracing", |
|
33097 | 44 |
"Logging", |
37491
edf4cc53f5a3
8153039: Command line processing should use mtCommand or mtArguments rather than mtInternal for NMT
gziemski
parents:
33097
diff
changeset
|
45 |
"Arguments", |
38733 | 46 |
"Module", |
25946 | 47 |
"Unknown" |
48 |
}; |
|
49 |
||
50 |
||
51 |
const char* NMTUtil::scale_name(size_t scale) { |
|
52 |
switch(scale) { |
|
53 |
case K: return "KB"; |
|
54 |
case M: return "MB"; |
|
55 |
case G: return "GB"; |
|
56 |
} |
|
57 |
ShouldNotReachHere(); |
|
58 |
return NULL; |
|
59 |
} |
|
60 |
||
61 |
size_t NMTUtil::scale_from_name(const char* scale) { |
|
62 |
assert(scale != NULL, "Null pointer check"); |
|
49980 | 63 |
if (strcasecmp(scale, "1") == 0 || strcasecmp(scale, "b") == 0) { |
64 |
return 1; |
|
65 |
} else if (strcasecmp(scale, "kb") == 0 || strcasecmp(scale, "k") == 0) { |
|
25946 | 66 |
return K; |
49980 | 67 |
} else if (strcasecmp(scale, "mb") == 0 || strcasecmp(scale, "m") == 0) { |
25946 | 68 |
return M; |
49980 | 69 |
} else if (strcasecmp(scale, "gb") == 0 || strcasecmp(scale, "g") == 0) { |
25946 | 70 |
return G; |
71 |
} else { |
|
72 |
return 0; // Invalid value |
|
73 |
} |
|
74 |
return K; |
|
75 |
} |
|
76 |