src/share/vm/services/diagnosticCommand.hpp

Tue, 30 Apr 2013 09:17:06 -0400

author
zgu
date
Tue, 30 Apr 2013 09:17:06 -0400
changeset 4992
ed5a590835a4
parent 4544
3c9bc17b9403
child 5047
31a4e55f8c9d
permissions
-rw-r--r--

8013214: BigApps fails due to 'fatal error: Illegal threadstate encountered: 6'
Summary: Grab and drop SR_lock to get the thread to honor the safepoint protocol
Reviewed-by: dcubed, coleenp

fparain@3329 1 /*
acorn@4497 2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
fparain@3329 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fparain@3329 4 *
fparain@3329 5 * This code is free software; you can redistribute it and/or modify it
fparain@3329 6 * under the terms of the GNU General Public License version 2 only, as
fparain@3329 7 * published by the Free Software Foundation.
fparain@3329 8 *
fparain@3329 9 * This code is distributed in the hope that it will be useful, but WITHOUT
fparain@3329 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fparain@3329 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fparain@3329 12 * version 2 for more details (a copy is included in the LICENSE file that
fparain@3329 13 * accompanied this code).
fparain@3329 14 *
fparain@3329 15 * You should have received a copy of the GNU General Public License version
fparain@3329 16 * 2 along with this work; if not, write to the Free Software Foundation,
fparain@3329 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fparain@3329 18 *
fparain@3329 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fparain@3329 20 * or visit www.oracle.com if you need additional information or have any
fparain@3329 21 * questions.
fparain@3329 22 *
fparain@3329 23 */
fparain@3329 24
fparain@3329 25 #ifndef SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP
fparain@3329 26 #define SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP
fparain@3329 27
fparain@3329 28 #include "runtime/arguments.hpp"
fparain@3329 29 #include "classfile/vmSymbols.hpp"
fparain@3329 30 #include "utilities/ostream.hpp"
fparain@3329 31 #include "runtime/vm_version.hpp"
fparain@3329 32 #include "runtime/vmThread.hpp"
fparain@3329 33 #include "runtime/os.hpp"
fparain@3329 34 #include "services/diagnosticArgument.hpp"
fparain@3329 35 #include "services/diagnosticCommand.hpp"
fparain@3329 36 #include "services/diagnosticFramework.hpp"
dsamersoff@3478 37 #include "services/diagnosticCommand_ext.hpp"
jprovino@4542 38 #include "utilities/macros.hpp"
fparain@3329 39
fparain@3402 40 class HelpDCmd : public DCmdWithParser {
fparain@3329 41 protected:
fparain@3329 42 DCmdArgument<bool> _all;
fparain@3329 43 DCmdArgument<char*> _cmd;
fparain@3329 44 public:
fparain@3329 45 HelpDCmd(outputStream* output, bool heap);
fparain@3329 46 static const char* name() { return "help"; }
fparain@3329 47 static const char* description() {
fparain@3329 48 return "For more information about a specific command use 'help <command>'. "
fparain@3329 49 "With no argument this will show a list of available commands. "
fparain@3329 50 "'help all' will show help for all commands.";
fparain@3329 51 }
sla@3905 52 static const char* impact() { return "Low"; }
fparain@3329 53 static int num_arguments();
fparain@3329 54 virtual void execute(TRAPS);
fparain@3329 55 };
fparain@3329 56
fparain@3329 57 class VersionDCmd : public DCmd {
fparain@3329 58 public:
fparain@3329 59 VersionDCmd(outputStream* output, bool heap) : DCmd(output,heap) { }
fparain@3329 60 static const char* name() { return "VM.version"; }
fparain@3329 61 static const char* description() {
fparain@3329 62 return "Print JVM version information.";
fparain@3329 63 }
sla@3905 64 static const char* impact() { return "Low"; }
fparain@3329 65 static int num_arguments() { return 0; }
fparain@3329 66 virtual void execute(TRAPS);
fparain@3402 67 };
fparain@3402 68
fparain@3402 69 class CommandLineDCmd : public DCmd {
fparain@3402 70 public:
fparain@3402 71 CommandLineDCmd(outputStream* output, bool heap) : DCmd(output, heap) { }
fparain@3402 72 static const char* name() { return "VM.command_line"; }
fparain@3402 73 static const char* description() {
fparain@3402 74 return "Print the command line used to start this VM instance.";
fparain@3402 75 }
sla@3905 76 static const char* impact() { return "Low"; }
fparain@3402 77 static int num_arguments() { return 0; }
fparain@3402 78 virtual void execute(TRAPS) {
fparain@3402 79 Arguments::print_on(_output);
fparain@3402 80 }
fparain@3402 81 };
fparain@3402 82
fparain@3402 83 // See also: get_system_properties in attachListener.cpp
fparain@3402 84 class PrintSystemPropertiesDCmd : public DCmd {
fparain@3402 85 public:
fparain@3402 86 PrintSystemPropertiesDCmd(outputStream* output, bool heap) : DCmd(output, heap) { }
fparain@3402 87 static const char* name() { return "VM.system_properties"; }
fparain@3402 88 static const char* description() {
fparain@3402 89 return "Print system properties.";
fparain@3402 90 }
fparain@3402 91 static const char* impact() {
sla@3905 92 return "Low";
fparain@3402 93 }
fparain@3402 94 static int num_arguments() { return 0; }
fparain@3402 95 virtual void execute(TRAPS);
fparain@3402 96 };
fparain@3402 97
fparain@3402 98 // See also: print_flag in attachListener.cpp
fparain@3402 99 class PrintVMFlagsDCmd : public DCmdWithParser {
fparain@3402 100 protected:
fparain@3402 101 DCmdArgument<bool> _all;
fparain@3402 102 public:
fparain@3402 103 PrintVMFlagsDCmd(outputStream* output, bool heap);
fparain@3402 104 static const char* name() { return "VM.flags"; }
fparain@3402 105 static const char* description() {
fparain@3402 106 return "Print VM flag options and their current values.";
fparain@3402 107 }
fparain@3402 108 static const char* impact() {
sla@3905 109 return "Low";
fparain@3402 110 }
fparain@3402 111 static int num_arguments();
fparain@3402 112 virtual void execute(TRAPS);
fparain@3402 113 };
fparain@3402 114
fparain@3402 115 class VMUptimeDCmd : public DCmdWithParser {
fparain@3402 116 protected:
fparain@3402 117 DCmdArgument<bool> _date;
fparain@3402 118 public:
fparain@3402 119 VMUptimeDCmd(outputStream* output, bool heap);
fparain@3402 120 static const char* name() { return "VM.uptime"; }
fparain@3402 121 static const char* description() {
fparain@3402 122 return "Print VM uptime.";
fparain@3402 123 }
fparain@3402 124 static const char* impact() {
sla@3905 125 return "Low";
fparain@3402 126 }
fparain@3402 127 static int num_arguments();
fparain@3402 128 virtual void execute(TRAPS);
fparain@3402 129 };
fparain@3402 130
fparain@3402 131 class SystemGCDCmd : public DCmd {
fparain@3402 132 public:
fparain@3402 133 SystemGCDCmd(outputStream* output, bool heap) : DCmd(output, heap) { }
fparain@3402 134 static const char* name() { return "GC.run"; }
fparain@3402 135 static const char* description() {
fparain@3402 136 return "Call java.lang.System.gc().";
fparain@3402 137 }
fparain@3402 138 static const char* impact() {
fparain@3402 139 return "Medium: Depends on Java heap size and content.";
fparain@3402 140 }
fparain@3402 141 static int num_arguments() { return 0; }
fparain@3402 142 virtual void execute(TRAPS);
fparain@3402 143 };
fparain@3402 144
fparain@3402 145 class RunFinalizationDCmd : public DCmd {
fparain@3402 146 public:
fparain@3402 147 RunFinalizationDCmd(outputStream* output, bool heap) : DCmd(output, heap) { }
fparain@3402 148 static const char* name() { return "GC.run_finalization"; }
fparain@3402 149 static const char* description() {
fparain@3402 150 return "Call java.lang.System.runFinalization().";
fparain@3402 151 }
fparain@3402 152 static const char* impact() {
fparain@3402 153 return "Medium: Depends on Java content.";
fparain@3402 154 }
fparain@3402 155 static int num_arguments() { return 0; }
fparain@3402 156 virtual void execute(TRAPS);
fparain@3402 157 };
fparain@3402 158
jprovino@4165 159 #if INCLUDE_SERVICES // Heap dumping supported
fparain@3402 160 // See also: dump_heap in attachListener.cpp
fparain@3402 161 class HeapDumpDCmd : public DCmdWithParser {
fparain@3402 162 protected:
fparain@3402 163 DCmdArgument<char*> _filename;
fparain@3402 164 DCmdArgument<bool> _all;
fparain@3402 165 public:
fparain@3402 166 HeapDumpDCmd(outputStream* output, bool heap);
fparain@3402 167 static const char* name() {
fparain@3402 168 return "GC.heap_dump";
fparain@3402 169 }
fparain@3402 170 static const char* description() {
fparain@3402 171 return "Generate a HPROF format dump of the Java heap.";
fparain@3402 172 }
fparain@3402 173 static const char* impact() {
fparain@3402 174 return "High: Depends on Java heap size and content. "
fparain@3402 175 "Request a full GC unless the '-all' option is specified.";
fparain@3402 176 }
fparain@3402 177 static int num_arguments();
fparain@3402 178 virtual void execute(TRAPS);
fparain@3402 179 };
jprovino@4165 180 #endif // INCLUDE_SERVICES
fparain@3402 181
acorn@4497 182 // See also: inspectheap in attachListener.cpp
fparain@3402 183 class ClassHistogramDCmd : public DCmdWithParser {
fparain@3402 184 protected:
fparain@3402 185 DCmdArgument<bool> _all;
fparain@3402 186 public:
fparain@3402 187 ClassHistogramDCmd(outputStream* output, bool heap);
fparain@3402 188 static const char* name() {
fparain@3402 189 return "GC.class_histogram";
fparain@3402 190 }
fparain@3402 191 static const char* description() {
fparain@3402 192 return "Provide statistics about the Java heap usage.";
fparain@3402 193 }
fparain@3402 194 static const char* impact() {
fparain@3402 195 return "High: Depends on Java heap size and content.";
fparain@3402 196 }
fparain@3402 197 static int num_arguments();
fparain@3402 198 virtual void execute(TRAPS);
fparain@3402 199 };
fparain@3402 200
acorn@4497 201 class ClassStatsDCmd : public DCmdWithParser {
acorn@4497 202 protected:
acorn@4497 203 DCmdArgument<bool> _all;
acorn@4497 204 DCmdArgument<bool> _csv;
acorn@4497 205 DCmdArgument<bool> _help;
acorn@4497 206 DCmdArgument<char*> _columns;
acorn@4497 207 public:
acorn@4497 208 ClassStatsDCmd(outputStream* output, bool heap);
acorn@4497 209 static const char* name() {
acorn@4497 210 return "GC.class_stats";
acorn@4497 211 }
acorn@4497 212 static const char* description() {
acorn@4497 213 return "Provide statistics about Java class meta data. Requires -XX:+UnlockDiagnosticVMOptions.";
acorn@4497 214 }
acorn@4497 215 static const char* impact() {
acorn@4497 216 return "High: Depends on Java heap size and content.";
acorn@4497 217 }
acorn@4497 218 static int num_arguments();
acorn@4497 219 virtual void execute(TRAPS);
acorn@4497 220 };
acorn@4497 221
fparain@3402 222 // See also: thread_dump in attachListener.cpp
fparain@3402 223 class ThreadDumpDCmd : public DCmdWithParser {
fparain@3402 224 protected:
fparain@3402 225 DCmdArgument<bool> _locks;
fparain@3402 226 public:
fparain@3402 227 ThreadDumpDCmd(outputStream* output, bool heap);
fparain@3402 228 static const char* name() { return "Thread.print"; }
fparain@3402 229 static const char* description() {
fparain@3402 230 return "Print all threads with stacktraces.";
fparain@3402 231 }
fparain@3402 232 static const char* impact() {
fparain@3402 233 return "Medium: Depends on the number of threads.";
fparain@3402 234 }
fparain@3402 235 static int num_arguments();
fparain@3402 236 virtual void execute(TRAPS);
fparain@3329 237 };
fparain@3329 238
dsamersoff@3598 239 // Enhanced JMX Agent support
dsamersoff@3598 240
dsamersoff@3598 241 class JMXStartRemoteDCmd : public DCmdWithParser {
dsamersoff@3598 242
dsamersoff@3598 243 // Explicitly list all properties that could be
dsamersoff@3598 244 // passed to Agent.startRemoteManagementAgent()
dsamersoff@3598 245 // com.sun.management is omitted
dsamersoff@3598 246
dsamersoff@3598 247 DCmdArgument<char *> _config_file;
dsamersoff@3598 248 DCmdArgument<char *> _jmxremote_port;
dsamersoff@3598 249 DCmdArgument<char *> _jmxremote_rmi_port;
dsamersoff@3598 250 DCmdArgument<char *> _jmxremote_ssl;
dsamersoff@3598 251 DCmdArgument<char *> _jmxremote_registry_ssl;
dsamersoff@3598 252 DCmdArgument<char *> _jmxremote_authenticate;
dsamersoff@3598 253 DCmdArgument<char *> _jmxremote_password_file;
dsamersoff@3598 254 DCmdArgument<char *> _jmxremote_access_file;
dsamersoff@3598 255 DCmdArgument<char *> _jmxremote_login_config;
dsamersoff@3598 256 DCmdArgument<char *> _jmxremote_ssl_enabled_cipher_suites;
dsamersoff@3598 257 DCmdArgument<char *> _jmxremote_ssl_enabled_protocols;
dsamersoff@3598 258 DCmdArgument<char *> _jmxremote_ssl_need_client_auth;
dsamersoff@3598 259 DCmdArgument<char *> _jmxremote_ssl_config_file;
dsamersoff@3598 260
dsamersoff@4520 261 // JDP support
dsamersoff@4520 262 // Keep autodiscovery char* not bool to pass true/false
dsamersoff@4520 263 // as property value to java level.
dsamersoff@4520 264 DCmdArgument<char *> _jmxremote_autodiscovery;
dsamersoff@4520 265 DCmdArgument<jlong> _jdp_port;
dsamersoff@4520 266 DCmdArgument<char *> _jdp_address;
dsamersoff@4520 267 DCmdArgument<char *> _jdp_source_addr;
dsamersoff@4520 268 DCmdArgument<jlong> _jdp_ttl;
dsamersoff@4520 269 DCmdArgument<jlong> _jdp_pause;
dsamersoff@4520 270
dsamersoff@3598 271 public:
dsamersoff@3598 272 JMXStartRemoteDCmd(outputStream *output, bool heap_allocated);
dsamersoff@3598 273
dsamersoff@3598 274 static const char *name() {
dsamersoff@3598 275 return "ManagementAgent.start";
dsamersoff@3598 276 }
dsamersoff@3598 277
dsamersoff@3598 278 static const char *description() {
dsamersoff@3598 279 return "Start remote management agent.";
dsamersoff@3598 280 }
dsamersoff@3598 281
dsamersoff@3598 282 static int num_arguments();
dsamersoff@3598 283
dsamersoff@3598 284 virtual void execute(TRAPS);
dsamersoff@3598 285
dsamersoff@3598 286 };
dsamersoff@3598 287
dsamersoff@3598 288 class JMXStartLocalDCmd : public DCmd {
dsamersoff@3598 289
dsamersoff@3598 290 // Explicitly request start of local agent,
dsamersoff@3598 291 // it will not be started by start dcmd
dsamersoff@3598 292
dsamersoff@3598 293
dsamersoff@3598 294 public:
dsamersoff@3598 295 JMXStartLocalDCmd(outputStream *output, bool heap_allocated);
dsamersoff@3598 296
dsamersoff@3598 297 static const char *name() {
dsamersoff@3598 298 return "ManagementAgent.start_local";
dsamersoff@3598 299 }
dsamersoff@3598 300
dsamersoff@3598 301 static const char *description() {
dsamersoff@3598 302 return "Start local management agent.";
dsamersoff@3598 303 }
dsamersoff@3598 304
dsamersoff@3598 305 virtual void execute(TRAPS);
dsamersoff@3598 306
dsamersoff@3598 307 };
dsamersoff@3598 308
dsamersoff@3598 309 class JMXStopRemoteDCmd : public DCmd {
dsamersoff@3598 310 public:
dsamersoff@3598 311 JMXStopRemoteDCmd(outputStream *output, bool heap_allocated) :
dsamersoff@3598 312 DCmd(output, heap_allocated) {
dsamersoff@3598 313 // Do Nothing
dsamersoff@3598 314 }
dsamersoff@3598 315
dsamersoff@3598 316 static const char *name() {
dsamersoff@3598 317 return "ManagementAgent.stop";
dsamersoff@3598 318 }
dsamersoff@3598 319
dsamersoff@3598 320 static const char *description() {
dsamersoff@3598 321 return "Stop remote management agent.";
dsamersoff@3598 322 }
dsamersoff@3598 323
dsamersoff@3598 324 virtual void execute(TRAPS);
dsamersoff@3598 325 };
dsamersoff@3598 326
fparain@3329 327 #endif // SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP

mercurial