hotspot/src/share/vm/services/diagnosticCommand.hpp
author coleenp
Fri, 23 Mar 2012 11:16:05 -0400
changeset 12263 d20640f4f8fe
parent 11953 d06edd28ba62
child 13200 7b506e7b406e
permissions -rw-r--r--
7150058: Allocate symbols from null boot loader to an arena for NMT Summary: Move symbol allocation to an arena so NMT doesn't have to track them at startup. Reviewed-by: never, kamg, zgu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11209
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     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
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     4
 *
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     7
 * published by the Free Software Foundation.
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     8
 *
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    13
 * accompanied this code).
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    14
 *
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    18
 *
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    21
 * questions.
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    22
 *
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    23
 */
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    24
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    25
#ifndef SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    26
#define SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    27
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    28
#include "runtime/arguments.hpp"
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    29
#include "classfile/vmSymbols.hpp"
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    30
#include "utilities/ostream.hpp"
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    31
#include "runtime/vm_version.hpp"
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    32
#include "runtime/vmThread.hpp"
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    33
#include "runtime/os.hpp"
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    34
#include "services/diagnosticArgument.hpp"
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    35
#include "services/diagnosticCommand.hpp"
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    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
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    38
11441
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    39
class HelpDCmd : public DCmdWithParser {
11209
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    40
protected:
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    41
  DCmdArgument<bool> _all;
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    42
  DCmdArgument<char*> _cmd;
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    43
public:
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    44
  HelpDCmd(outputStream* output, bool heap);
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    45
  static const char* name() { return "help"; }
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    46
  static const char* description() {
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    47
    return "For more information about a specific command use 'help <command>'. "
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    48
           "With no argument this will show a list of available commands. "
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    49
           "'help all' will show help for all commands.";
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    50
  }
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    51
  static const char* impact() { return "Low: "; }
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    52
  static int num_arguments();
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    53
  virtual void execute(TRAPS);
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    54
};
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    55
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    56
class VersionDCmd : public DCmd {
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    57
public:
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    58
  VersionDCmd(outputStream* output, bool heap) : DCmd(output,heap) { }
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    59
  static const char* name() { return "VM.version"; }
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    60
  static const char* description() {
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    61
    return "Print JVM version information.";
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    62
  }
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    63
  static const char* impact() { return "Low: "; }
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    64
  static int num_arguments() { return 0; }
11441
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    65
  virtual void execute(TRAPS);
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    66
};
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    67
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    68
class CommandLineDCmd : public DCmd {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    69
public:
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    70
  CommandLineDCmd(outputStream* output, bool heap) : DCmd(output, heap) { }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    71
  static const char* name() { return "VM.command_line"; }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    72
  static const char* description() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    73
    return "Print the command line used to start this VM instance.";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    74
  }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    75
  static const char* impact() { return "Low: "; }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    76
  static int num_arguments() { return 0; }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    77
  virtual void execute(TRAPS) {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    78
    Arguments::print_on(_output);
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    79
  }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    80
};
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    81
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    82
// See also: get_system_properties in attachListener.cpp
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    83
class PrintSystemPropertiesDCmd : public DCmd {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    84
public:
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    85
  PrintSystemPropertiesDCmd(outputStream* output, bool heap) : DCmd(output, heap) { }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    86
    static const char* name() { return "VM.system_properties"; }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    87
    static const char* description() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    88
      return "Print system properties.";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    89
    }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    90
    static const char* impact() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    91
      return "Low: ";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    92
    }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    93
    static int num_arguments() { return 0; }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    94
    virtual void execute(TRAPS);
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    95
};
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    96
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    97
// See also: print_flag in attachListener.cpp
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    98
class PrintVMFlagsDCmd : public DCmdWithParser {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
    99
protected:
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   100
  DCmdArgument<bool> _all;
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   101
public:
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   102
  PrintVMFlagsDCmd(outputStream* output, bool heap);
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   103
  static const char* name() { return "VM.flags"; }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   104
  static const char* description() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   105
    return "Print VM flag options and their current values.";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   106
  }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   107
  static const char* impact() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   108
    return "Low: ";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   109
  }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   110
  static int num_arguments();
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   111
  virtual void execute(TRAPS);
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   112
};
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   113
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   114
class VMUptimeDCmd : public DCmdWithParser {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   115
protected:
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   116
  DCmdArgument<bool> _date;
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   117
public:
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   118
  VMUptimeDCmd(outputStream* output, bool heap);
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   119
  static const char* name() { return "VM.uptime"; }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   120
  static const char* description() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   121
    return "Print VM uptime.";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   122
  }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   123
  static const char* impact() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   124
    return "Low: ";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   125
  }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   126
  static int num_arguments();
11209
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
   127
  virtual void execute(TRAPS);
11441
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   128
};
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   129
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   130
class SystemGCDCmd : public DCmd {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   131
public:
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   132
  SystemGCDCmd(outputStream* output, bool heap) : DCmd(output, heap) { }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   133
    static const char* name() { return "GC.run"; }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   134
    static const char* description() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   135
      return "Call java.lang.System.gc().";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   136
    }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   137
    static const char* impact() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   138
      return "Medium: Depends on Java heap size and content.";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   139
    }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   140
    static int num_arguments() { return 0; }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   141
    virtual void execute(TRAPS);
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   142
};
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   143
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   144
class RunFinalizationDCmd : public DCmd {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   145
public:
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   146
  RunFinalizationDCmd(outputStream* output, bool heap) : DCmd(output, heap) { }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   147
    static const char* name() { return "GC.run_finalization"; }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   148
    static const char* description() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   149
      return "Call java.lang.System.runFinalization().";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   150
    }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   151
    static const char* impact() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   152
      return "Medium: Depends on Java content.";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   153
    }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   154
    static int num_arguments() { return 0; }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   155
    virtual void execute(TRAPS);
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   156
};
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   157
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   158
#ifndef SERVICES_KERNEL   // Heap dumping not supported
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   159
// See also: dump_heap in attachListener.cpp
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   160
class HeapDumpDCmd : public DCmdWithParser {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   161
protected:
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   162
  DCmdArgument<char*> _filename;
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   163
  DCmdArgument<bool>  _all;
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   164
public:
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   165
  HeapDumpDCmd(outputStream* output, bool heap);
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   166
  static const char* name() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   167
    return "GC.heap_dump";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   168
  }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   169
  static const char* description() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   170
    return "Generate a HPROF format dump of the Java heap.";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   171
  }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   172
  static const char* impact() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   173
    return "High: Depends on Java heap size and content. "
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   174
           "Request a full GC unless the '-all' option is specified.";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   175
  }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   176
  static int num_arguments();
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   177
  virtual void execute(TRAPS);
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   178
};
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   179
#endif // SERVICES_KERNEL
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   180
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   181
// See also: inspeactheap in attachListener.cpp
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   182
class ClassHistogramDCmd : public DCmdWithParser {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   183
protected:
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   184
  DCmdArgument<bool> _all;
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   185
public:
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   186
  ClassHistogramDCmd(outputStream* output, bool heap);
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   187
  static const char* name() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   188
    return "GC.class_histogram";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   189
  }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   190
  static const char* description() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   191
    return "Provide statistics about the Java heap usage.";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   192
  }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   193
  static const char* impact() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   194
    return "High: Depends on Java heap size and content.";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   195
  }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   196
  static int num_arguments();
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   197
  virtual void execute(TRAPS);
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   198
};
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   199
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   200
// See also: thread_dump in attachListener.cpp
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   201
class ThreadDumpDCmd : public DCmdWithParser {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   202
protected:
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   203
  DCmdArgument<bool> _locks;
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   204
public:
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   205
  ThreadDumpDCmd(outputStream* output, bool heap);
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   206
  static const char* name() { return "Thread.print"; }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   207
  static const char* description() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   208
    return "Print all threads with stacktraces.";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   209
  }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   210
  static const char* impact() {
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   211
    return "Medium: Depends on the number of threads.";
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   212
  }
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   213
  static int num_arguments();
a89f443814cd 7120511: Add diagnostic commands
fparain
parents: 11209
diff changeset
   214
  virtual void execute(TRAPS);
11209
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
   215
};
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
   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
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
   295
#endif // SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP