author | zgu |
Thu, 07 Aug 2014 12:18:58 -0700 | |
changeset 25946 | 1572c9f03fb9 |
parent 17296 | 68557efd8583 |
permissions | -rw-r--r-- |
13195 | 1 |
/* |
25946 | 2 |
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
13195 | 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 |
||
25 |
#ifndef SHARE_VM_SERVICES_NMT_DCMD_HPP |
|
26 |
#define SHARE_VM_SERVICES_NMT_DCMD_HPP |
|
27 |
||
25946 | 28 |
#if INCLUDE_NMT |
29 |
||
13195 | 30 |
#include "services/diagnosticArgument.hpp" |
31 |
#include "services/diagnosticFramework.hpp" |
|
25946 | 32 |
#include "services/memBaseline.hpp" |
33 |
#include "services/mallocTracker.hpp" |
|
13195 | 34 |
|
35 |
/** |
|
36 |
* Native memory tracking DCmd implementation |
|
37 |
*/ |
|
38 |
class NMTDCmd: public DCmdWithParser { |
|
39 |
protected: |
|
40 |
DCmdArgument<bool> _summary; |
|
41 |
DCmdArgument<bool> _detail; |
|
42 |
DCmdArgument<bool> _baseline; |
|
43 |
DCmdArgument<bool> _summary_diff; |
|
44 |
DCmdArgument<bool> _detail_diff; |
|
45 |
DCmdArgument<bool> _shutdown; |
|
25946 | 46 |
DCmdArgument<bool> _statistics; |
13195 | 47 |
DCmdArgument<char*> _scale; |
48 |
||
49 |
public: |
|
50 |
NMTDCmd(outputStream* output, bool heap); |
|
51 |
static const char* name() { return "VM.native_memory"; } |
|
52 |
static const char* description() { |
|
53 |
return "Print native memory usage"; |
|
54 |
} |
|
55 |
static const char* impact() { |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
16436
diff
changeset
|
56 |
return "Medium"; |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
16436
diff
changeset
|
57 |
} |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
16436
diff
changeset
|
58 |
static const JavaPermission permission() { |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
16436
diff
changeset
|
59 |
JavaPermission p = {"java.lang.management.ManagementPermission", |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
16436
diff
changeset
|
60 |
"monitor", NULL}; |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
16436
diff
changeset
|
61 |
return p; |
13195 | 62 |
} |
63 |
static int num_arguments(); |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
16436
diff
changeset
|
64 |
virtual void execute(DCmdSource source, TRAPS); |
25946 | 65 |
|
66 |
private: |
|
67 |
void report(bool summaryOnly, size_t scale); |
|
68 |
void report_diff(bool summaryOnly, size_t scale); |
|
69 |
||
70 |
size_t get_scale(const char* scale) const; |
|
71 |
||
72 |
// check if NMT running at detail tracking level |
|
73 |
bool check_detail_tracking_level(outputStream* out); |
|
13195 | 74 |
}; |
75 |
||
25946 | 76 |
#endif // INCLUDE_NMT |
77 |
||
13195 | 78 |
#endif // SHARE_VM_SERVICES_NMT_DCMD_HPP |