3261N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. 2362N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A// CmdLine is the class used to handle a command line containing a single 0N/A// diagnostic command and its arguments. It provides methods to access the 0N/A// command name and the beginning of the arguments. The class is also 0N/A// able to identify commented command lines and the "stop" keyword 0N/A// Iterator class taking a character string in input and returning a CmdLine 0N/A// instance for each command line. The argument delimiter has to be specified. 0N/A // The default copy constructor of CmdLine is used to return a CmdLine 0N/A // instance to the caller. 0N/A// Iterator class to iterate over diagnostic command arguments 2153N/A// A DCmdInfo instance provides a description of a diagnostic command. It is 2153N/A// used to export the description to the JMX interface of the framework. 0N/A// A DCmdArgumentInfo instance provides a description of a diagnostic command 0N/A// argument. It is used to export the description to the JMX interface of the 0N/A// The DCmdParser class can be used to create an argument parser for a 0N/A// diagnostic command. It is not mandatory to use it to parse arguments. 0N/A// The DCmd class is the parent class of all diagnostic commands 0N/A// Diagnostic command instances should not be instantiated directly but 0N/A// created using the associated factory. The factory can be retrieved with 0N/A// the DCmdFactory::getFactory() method. 0N/A// A diagnostic command instance can either be allocated in the resource Area 0N/A// or in the C-heap. Allocation in the resource area is recommended when the 0N/A// current thread is the only one which will access the diagnostic command 0N/A// instance. Allocation in the C-heap is required when the diagnostic command 0N/A// is accessed by several threads (for instance to perform asynchronous 0N/A// To ensure a proper cleanup, it's highly recommended to use a DCmdMark for 0N/A// each diagnostic command instance. In case of a C-heap allocated diagnostic 0N/A// command instance, the DCmdMark must be created in the context of the last 0N/A// thread that will access the instance. 0N/A static const char*
name() {
return "No Name";}
0N/A // The impact() method returns a description of the intrusiveness of the diagnostic 0N/A // command on the Java Virtual Machine behavior. The rational for this method is that some 0N/A // diagnostic commands can seriously disrupt the behavior of the Java Virtual Machine 0N/A // (for instance a Thread Dump for an application with several tens of thousands of threads, 0N/A // or a Head Dump with a 40GB+ heap size) and other diagnostic commands have no serious 0N/A // impact on the JVM (for instance, getting the command line arguments or the JVM version). 0N/A // The recommended format for the description is <impact level>: [longer description], 0N/A // where the impact level is selected among this list: {Low, Medium, High}. The optional 0N/A // longer description can provide more specific details like the fact that Thread Dump 0N/A // impact depends on the heap size. 0N/A static const char*
impact() {
return "Low: No impact"; }
0N/A "The argument list of this diagnostic command should be empty.");
0N/A // support for the JMX interface 0N/A // main method to invoke the framework 0N/A static const char*
name() {
return "No Name";}
0N/A static const char*
impact() {
return "Low: No impact"; }
0N/A// Diagnostic commands are not directly instantiated but created with a factory. 0N/A// Each diagnostic command class has its own factory. The DCmdFactory class also 0N/A// manages the status of the diagnostic command (hidden, enabled). A DCmdFactory 0N/A// has to be registered to make the diagnostic command available (see 0N/A // Pointer to the next factory in the singly-linked list of registered 0N/A // diagnostic commands 0N/A // When disabled, a diagnostic command cannot be executed. Any attempt to 0N/A // execute it will result in the printing of the disabled message without 0N/A // instantiating the command. 0N/A // When hidden, a diagnostic command doesn't appear in the list of commands 0N/A // provided by the 'help' command. 0N/A virtual const char*
name()
const = 0;
0N/A // Register a DCmdFactory to make a diagnostic command available. 0N/A // Once registered, a diagnostic command must not be unregistered. 0N/A // To prevent a diagnostic command from being executed, just set the 0N/A // enabled flag to false. 0N/A // Returns a C-heap allocated diagnostic command for the given command line 0N/A // Returns a resourceArea allocated diagnostic command for the given command line 0N/A// where this template is used to create and register factories. 0N/A // Returns a C-heap allocated instance 0N/A // Returns a resourceArea allocated instance 0N/A// This class provides a convenient way to register Dcmds, without a need to change 0N/A#
endif // SHARE_VM_SERVICES_DIAGNOSTICFRAMEWORK_HPP