hotspot/src/share/vm/services/diagnosticCommand.hpp
author lana
Wed, 28 Dec 2011 10:51:24 -0800
changeset 11360 cfa173720adb
parent 11209 110525ac80b0
child 11441 a89f443814cd
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11209
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     1
/*
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     2
 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
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"
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    37
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    38
class HelpDCmd : public DCmd {
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    39
protected:
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    40
  DCmdParser _dcmdparser;
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 parse(CmdLine* line, char delim, TRAPS);
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    54
  virtual void execute(TRAPS);
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    55
  virtual void reset(TRAPS);
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    56
  virtual void cleanup();
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    57
  virtual void print_help(outputStream* out);
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    58
  virtual GrowableArray<const char*>* argument_name_array();
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    59
  virtual GrowableArray<DCmdArgumentInfo*>* argument_info_array();
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    60
};
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    61
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    62
class VersionDCmd : public DCmd {
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    63
public:
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    64
  VersionDCmd(outputStream* output, bool heap) : DCmd(output,heap) { }
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    65
  static const char* name() { return "VM.version"; }
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    66
  static const char* description() {
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    67
    return "Print JVM version information.";
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    68
  }
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    69
  static const char* impact() { return "Low: "; }
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    70
  static int num_arguments() { return 0; }
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    71
  virtual void parse(CmdLine* line, char delim, TRAPS) { }
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    72
  virtual void execute(TRAPS);
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    73
  virtual void print_help(outputStream* out) { }
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    74
};
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    75
110525ac80b0 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    76
#endif // SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP