author | coleenp |
Fri, 23 Mar 2012 11:16:05 -0400 | |
changeset 12263 | d20640f4f8fe |
parent 11953 | d06edd28ba62 |
child 13200 | 7b506e7b406e |
permissions | -rw-r--r-- |
11209 | 1 |
/* |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
2 |
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
11209 | 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_DIAGNOSTICCOMMAND_HPP |
|
26 |
#define SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP |
|
27 |
||
28 |
#include "runtime/arguments.hpp" |
|
29 |
#include "classfile/vmSymbols.hpp" |
|
30 |
#include "utilities/ostream.hpp" |
|
31 |
#include "runtime/vm_version.hpp" |
|
32 |
#include "runtime/vmThread.hpp" |
|
33 |
#include "runtime/os.hpp" |
|
34 |
#include "services/diagnosticArgument.hpp" |
|
35 |
#include "services/diagnosticCommand.hpp" |
|
36 |
#include "services/diagnosticFramework.hpp" |
|
11598
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
37 |
#include "services/diagnosticCommand_ext.hpp" |
11209 | 38 |
|
11441 | 39 |
class HelpDCmd : public DCmdWithParser { |
11209 | 40 |
protected: |
41 |
DCmdArgument<bool> _all; |
|
42 |
DCmdArgument<char*> _cmd; |
|
43 |
public: |
|
44 |
HelpDCmd(outputStream* output, bool heap); |
|
45 |
static const char* name() { return "help"; } |
|
46 |
static const char* description() { |
|
47 |
return "For more information about a specific command use 'help <command>'. " |
|
48 |
"With no argument this will show a list of available commands. " |
|
49 |
"'help all' will show help for all commands."; |
|
50 |
} |
|
51 |
static const char* impact() { return "Low: "; } |
|
52 |
static int num_arguments(); |
|
53 |
virtual void execute(TRAPS); |
|
54 |
}; |
|
55 |
||
56 |
class VersionDCmd : public DCmd { |
|
57 |
public: |
|
58 |
VersionDCmd(outputStream* output, bool heap) : DCmd(output,heap) { } |
|
59 |
static const char* name() { return "VM.version"; } |
|
60 |
static const char* description() { |
|
61 |
return "Print JVM version information."; |
|
62 |
} |
|
63 |
static const char* impact() { return "Low: "; } |
|
64 |
static int num_arguments() { return 0; } |
|
11441 | 65 |
virtual void execute(TRAPS); |
66 |
}; |
|
67 |
||
68 |
class CommandLineDCmd : public DCmd { |
|
69 |
public: |
|
70 |
CommandLineDCmd(outputStream* output, bool heap) : DCmd(output, heap) { } |
|
71 |
static const char* name() { return "VM.command_line"; } |
|
72 |
static const char* description() { |
|
73 |
return "Print the command line used to start this VM instance."; |
|
74 |
} |
|
75 |
static const char* impact() { return "Low: "; } |
|
76 |
static int num_arguments() { return 0; } |
|
77 |
virtual void execute(TRAPS) { |
|
78 |
Arguments::print_on(_output); |
|
79 |
} |
|
80 |
}; |
|
81 |
||
82 |
// See also: get_system_properties in attachListener.cpp |
|
83 |
class PrintSystemPropertiesDCmd : public DCmd { |
|
84 |
public: |
|
85 |
PrintSystemPropertiesDCmd(outputStream* output, bool heap) : DCmd(output, heap) { } |
|
86 |
static const char* name() { return "VM.system_properties"; } |
|
87 |
static const char* description() { |
|
88 |
return "Print system properties."; |
|
89 |
} |
|
90 |
static const char* impact() { |
|
91 |
return "Low: "; |
|
92 |
} |
|
93 |
static int num_arguments() { return 0; } |
|
94 |
virtual void execute(TRAPS); |
|
95 |
}; |
|
96 |
||
97 |
// See also: print_flag in attachListener.cpp |
|
98 |
class PrintVMFlagsDCmd : public DCmdWithParser { |
|
99 |
protected: |
|
100 |
DCmdArgument<bool> _all; |
|
101 |
public: |
|
102 |
PrintVMFlagsDCmd(outputStream* output, bool heap); |
|
103 |
static const char* name() { return "VM.flags"; } |
|
104 |
static const char* description() { |
|
105 |
return "Print VM flag options and their current values."; |
|
106 |
} |
|
107 |
static const char* impact() { |
|
108 |
return "Low: "; |
|
109 |
} |
|
110 |
static int num_arguments(); |
|
111 |
virtual void execute(TRAPS); |
|
112 |
}; |
|
113 |
||
114 |
class VMUptimeDCmd : public DCmdWithParser { |
|
115 |
protected: |
|
116 |
DCmdArgument<bool> _date; |
|
117 |
public: |
|
118 |
VMUptimeDCmd(outputStream* output, bool heap); |
|
119 |
static const char* name() { return "VM.uptime"; } |
|
120 |
static const char* description() { |
|
121 |
return "Print VM uptime."; |
|
122 |
} |
|
123 |
static const char* impact() { |
|
124 |
return "Low: "; |
|
125 |
} |
|
126 |
static int num_arguments(); |
|
11209 | 127 |
virtual void execute(TRAPS); |
11441 | 128 |
}; |
129 |
||
130 |
class SystemGCDCmd : public DCmd { |
|
131 |
public: |
|
132 |
SystemGCDCmd(outputStream* output, bool heap) : DCmd(output, heap) { } |
|
133 |
static const char* name() { return "GC.run"; } |
|
134 |
static const char* description() { |
|
135 |
return "Call java.lang.System.gc()."; |
|
136 |
} |
|
137 |
static const char* impact() { |
|
138 |
return "Medium: Depends on Java heap size and content."; |
|
139 |
} |
|
140 |
static int num_arguments() { return 0; } |
|
141 |
virtual void execute(TRAPS); |
|
142 |
}; |
|
143 |
||
144 |
class RunFinalizationDCmd : public DCmd { |
|
145 |
public: |
|
146 |
RunFinalizationDCmd(outputStream* output, bool heap) : DCmd(output, heap) { } |
|
147 |
static const char* name() { return "GC.run_finalization"; } |
|
148 |
static const char* description() { |
|
149 |
return "Call java.lang.System.runFinalization()."; |
|
150 |
} |
|
151 |
static const char* impact() { |
|
152 |
return "Medium: Depends on Java content."; |
|
153 |
} |
|
154 |
static int num_arguments() { return 0; } |
|
155 |
virtual void execute(TRAPS); |
|
156 |
}; |
|
157 |
||
158 |
#ifndef SERVICES_KERNEL // Heap dumping not supported |
|
159 |
// See also: dump_heap in attachListener.cpp |
|
160 |
class HeapDumpDCmd : public DCmdWithParser { |
|
161 |
protected: |
|
162 |
DCmdArgument<char*> _filename; |
|
163 |
DCmdArgument<bool> _all; |
|
164 |
public: |
|
165 |
HeapDumpDCmd(outputStream* output, bool heap); |
|
166 |
static const char* name() { |
|
167 |
return "GC.heap_dump"; |
|
168 |
} |
|
169 |
static const char* description() { |
|
170 |
return "Generate a HPROF format dump of the Java heap."; |
|
171 |
} |
|
172 |
static const char* impact() { |
|
173 |
return "High: Depends on Java heap size and content. " |
|
174 |
"Request a full GC unless the '-all' option is specified."; |
|
175 |
} |
|
176 |
static int num_arguments(); |
|
177 |
virtual void execute(TRAPS); |
|
178 |
}; |
|
179 |
#endif // SERVICES_KERNEL |
|
180 |
||
181 |
// See also: inspeactheap in attachListener.cpp |
|
182 |
class ClassHistogramDCmd : public DCmdWithParser { |
|
183 |
protected: |
|
184 |
DCmdArgument<bool> _all; |
|
185 |
public: |
|
186 |
ClassHistogramDCmd(outputStream* output, bool heap); |
|
187 |
static const char* name() { |
|
188 |
return "GC.class_histogram"; |
|
189 |
} |
|
190 |
static const char* description() { |
|
191 |
return "Provide statistics about the Java heap usage."; |
|
192 |
} |
|
193 |
static const char* impact() { |
|
194 |
return "High: Depends on Java heap size and content."; |
|
195 |
} |
|
196 |
static int num_arguments(); |
|
197 |
virtual void execute(TRAPS); |
|
198 |
}; |
|
199 |
||
200 |
// See also: thread_dump in attachListener.cpp |
|
201 |
class ThreadDumpDCmd : public DCmdWithParser { |
|
202 |
protected: |
|
203 |
DCmdArgument<bool> _locks; |
|
204 |
public: |
|
205 |
ThreadDumpDCmd(outputStream* output, bool heap); |
|
206 |
static const char* name() { return "Thread.print"; } |
|
207 |
static const char* description() { |
|
208 |
return "Print all threads with stacktraces."; |
|
209 |
} |
|
210 |
static const char* impact() { |
|
211 |
return "Medium: Depends on the number of threads."; |
|
212 |
} |
|
213 |
static int num_arguments(); |
|
214 |
virtual void execute(TRAPS); |
|
11209 | 215 |
}; |
216 |
||
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
217 |
// Enhanced JMX Agent support |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
218 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
219 |
class JMXStartRemoteDCmd : public DCmdWithParser { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
220 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
221 |
// Explicitly list all properties that could be |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
222 |
// passed to Agent.startRemoteManagementAgent() |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
223 |
// com.sun.management is omitted |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
224 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
225 |
DCmdArgument<char *> _config_file; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
226 |
DCmdArgument<char *> _jmxremote_port; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
227 |
DCmdArgument<char *> _jmxremote_rmi_port; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
228 |
DCmdArgument<char *> _jmxremote_ssl; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
229 |
DCmdArgument<char *> _jmxremote_registry_ssl; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
230 |
DCmdArgument<char *> _jmxremote_authenticate; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
231 |
DCmdArgument<char *> _jmxremote_password_file; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
232 |
DCmdArgument<char *> _jmxremote_access_file; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
233 |
DCmdArgument<char *> _jmxremote_login_config; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
234 |
DCmdArgument<char *> _jmxremote_ssl_enabled_cipher_suites; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
235 |
DCmdArgument<char *> _jmxremote_ssl_enabled_protocols; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
236 |
DCmdArgument<char *> _jmxremote_ssl_need_client_auth; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
237 |
DCmdArgument<char *> _jmxremote_ssl_config_file; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
238 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
239 |
public: |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
240 |
JMXStartRemoteDCmd(outputStream *output, bool heap_allocated); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
241 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
242 |
static const char *name() { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
243 |
return "ManagementAgent.start"; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
244 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
245 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
246 |
static const char *description() { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
247 |
return "Start remote management agent."; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
248 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
249 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
250 |
static int num_arguments(); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
251 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
252 |
virtual void execute(TRAPS); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
253 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
254 |
}; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
255 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
256 |
class JMXStartLocalDCmd : public DCmd { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
257 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
258 |
// Explicitly request start of local agent, |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
259 |
// it will not be started by start dcmd |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
260 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
261 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
262 |
public: |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
263 |
JMXStartLocalDCmd(outputStream *output, bool heap_allocated); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
264 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
265 |
static const char *name() { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
266 |
return "ManagementAgent.start_local"; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
267 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
268 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
269 |
static const char *description() { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
270 |
return "Start local management agent."; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
271 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
272 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
273 |
virtual void execute(TRAPS); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
274 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
275 |
}; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
276 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
277 |
class JMXStopRemoteDCmd : public DCmd { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
278 |
public: |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
279 |
JMXStopRemoteDCmd(outputStream *output, bool heap_allocated) : |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
280 |
DCmd(output, heap_allocated) { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
281 |
// Do Nothing |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
282 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
283 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
284 |
static const char *name() { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
285 |
return "ManagementAgent.stop"; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
286 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
287 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
288 |
static const char *description() { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
289 |
return "Stop remote management agent."; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
290 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
291 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
292 |
virtual void execute(TRAPS); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
293 |
}; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
294 |
|
11209 | 295 |
#endif // SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP |