src/hotspot/share/services/diagnosticCommand.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File webrev Sdiff src/hotspot/share/services

src/hotspot/share/services/diagnosticCommand.cpp

Print this page




  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 #include "precompiled.hpp"
  26 #include "jvm.h"
  27 #include "classfile/classLoaderStats.hpp"
  28 #include "classfile/compactHashtable.hpp"
  29 #include "compiler/compileBroker.hpp"
  30 #include "compiler/directivesParser.hpp"
  31 #include "gc/shared/vmGCOperations.hpp"
  32 #include "memory/resourceArea.hpp"
  33 #include "oops/objArrayOop.inline.hpp"
  34 #include "oops/oop.inline.hpp"
  35 #include "oops/typeArrayOop.inline.hpp"
  36 #include "runtime/globals.hpp"
  37 #include "runtime/handles.inline.hpp"
  38 #include "runtime/javaCalls.hpp"
  39 #include "runtime/os.hpp"
  40 #include "services/diagnosticArgument.hpp"
  41 #include "services/diagnosticCommand.hpp"
  42 #include "services/diagnosticFramework.hpp"
  43 #include "services/heapDumper.hpp"
  44 #include "services/management.hpp"
  45 #include "services/writeableFlags.hpp"
  46 #include "utilities/debug.hpp"
  47 #include "utilities/formatBuffer.hpp"
  48 #include "utilities/macros.hpp"
  49 
  50 
  51 static void loadAgentModule(TRAPS) {
  52   ResourceMark rm(THREAD);
  53   HandleMark hm(THREAD);
  54 
  55   JavaValue result(T_OBJECT);
  56   Handle h_module_name = java_lang_String::create_from_str("jdk.management.agent", CHECK);


 207           Abstract_VM_Version::vm_release());
 208   JDK_Version jdk_version = JDK_Version::current();
 209   if (jdk_version.patch_version() > 0) {
 210     output()->print_cr("JDK %d.%d.%d.%d", jdk_version.major_version(),
 211             jdk_version.minor_version(), jdk_version.security_version(),
 212             jdk_version.patch_version());
 213   } else {
 214     output()->print_cr("JDK %d.%d.%d", jdk_version.major_version(),
 215             jdk_version.minor_version(), jdk_version.security_version());
 216   }
 217 }
 218 
 219 PrintVMFlagsDCmd::PrintVMFlagsDCmd(outputStream* output, bool heap) :
 220                                    DCmdWithParser(output, heap),
 221   _all("-all", "Print all flags supported by the VM", "BOOLEAN", false, "false") {
 222   _dcmdparser.add_dcmd_option(&_all);
 223 }
 224 
 225 void PrintVMFlagsDCmd::execute(DCmdSource source, TRAPS) {
 226   if (_all.value()) {
 227     CommandLineFlags::printFlags(output(), true);
 228   } else {
 229     CommandLineFlags::printSetFlags(output());
 230   }
 231 }
 232 
 233 int PrintVMFlagsDCmd::num_arguments() {
 234     ResourceMark rm;
 235     PrintVMFlagsDCmd* dcmd = new PrintVMFlagsDCmd(NULL, false);
 236     if (dcmd != NULL) {
 237       DCmdMark mark(dcmd);
 238       return dcmd->_dcmdparser.num_arguments();
 239     } else {
 240       return 0;
 241     }
 242 }
 243 
 244 SetVMFlagDCmd::SetVMFlagDCmd(outputStream* output, bool heap) :
 245                                    DCmdWithParser(output, heap),
 246   _flag("flag name", "The name of the flag we want to set",
 247         "STRING", true),
 248   _value("string value", "The value we want to set", "STRING", false) {
 249   _dcmdparser.add_dcmd_argument(&_flag);
 250   _dcmdparser.add_dcmd_argument(&_value);
 251 }
 252 
 253 void SetVMFlagDCmd::execute(DCmdSource source, TRAPS) {
 254   const char* val = NULL;
 255   if (_value.value() != NULL) {
 256     val = _value.value();
 257   }
 258 
 259   FormatBuffer<80> err_msg("%s", "");
 260   int ret = WriteableFlags::set_flag(_flag.value(), val, Flag::MANAGEMENT, err_msg);
 261 
 262   if (ret != Flag::SUCCESS) {
 263     output()->print_cr("%s", err_msg.buffer());
 264   }
 265 }
 266 
 267 int SetVMFlagDCmd::num_arguments() {
 268   ResourceMark rm;
 269   SetVMFlagDCmd* dcmd = new SetVMFlagDCmd(NULL, false);
 270   if (dcmd != NULL) {
 271     DCmdMark mark(dcmd);
 272     return dcmd->_dcmdparser.num_arguments();
 273   } else {
 274     return 0;
 275   }
 276 }
 277 
 278 void JVMTIDataDumpDCmd::execute(DCmdSource source, TRAPS) {
 279   if (JvmtiExport::should_post_data_dump()) {
 280     JvmtiExport::post_data_dump();
 281   }
 282 }




  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 #include "precompiled.hpp"
  26 #include "jvm.h"
  27 #include "classfile/classLoaderStats.hpp"
  28 #include "classfile/compactHashtable.hpp"
  29 #include "compiler/compileBroker.hpp"
  30 #include "compiler/directivesParser.hpp"
  31 #include "gc/shared/vmGCOperations.hpp"
  32 #include "memory/resourceArea.hpp"
  33 #include "oops/objArrayOop.inline.hpp"
  34 #include "oops/oop.inline.hpp"
  35 #include "oops/typeArrayOop.inline.hpp"

  36 #include "runtime/handles.inline.hpp"
  37 #include "runtime/javaCalls.hpp"
  38 #include "runtime/os.hpp"
  39 #include "services/diagnosticArgument.hpp"
  40 #include "services/diagnosticCommand.hpp"
  41 #include "services/diagnosticFramework.hpp"
  42 #include "services/heapDumper.hpp"
  43 #include "services/management.hpp"
  44 #include "services/writeableFlags.hpp"
  45 #include "utilities/debug.hpp"
  46 #include "utilities/formatBuffer.hpp"
  47 #include "utilities/macros.hpp"
  48 
  49 
  50 static void loadAgentModule(TRAPS) {
  51   ResourceMark rm(THREAD);
  52   HandleMark hm(THREAD);
  53 
  54   JavaValue result(T_OBJECT);
  55   Handle h_module_name = java_lang_String::create_from_str("jdk.management.agent", CHECK);


 206           Abstract_VM_Version::vm_release());
 207   JDK_Version jdk_version = JDK_Version::current();
 208   if (jdk_version.patch_version() > 0) {
 209     output()->print_cr("JDK %d.%d.%d.%d", jdk_version.major_version(),
 210             jdk_version.minor_version(), jdk_version.security_version(),
 211             jdk_version.patch_version());
 212   } else {
 213     output()->print_cr("JDK %d.%d.%d", jdk_version.major_version(),
 214             jdk_version.minor_version(), jdk_version.security_version());
 215   }
 216 }
 217 
 218 PrintVMFlagsDCmd::PrintVMFlagsDCmd(outputStream* output, bool heap) :
 219                                    DCmdWithParser(output, heap),
 220   _all("-all", "Print all flags supported by the VM", "BOOLEAN", false, "false") {
 221   _dcmdparser.add_dcmd_option(&_all);
 222 }
 223 
 224 void PrintVMFlagsDCmd::execute(DCmdSource source, TRAPS) {
 225   if (_all.value()) {
 226     JVMFlag::printFlags(output(), true);
 227   } else {
 228     JVMFlag::printSetFlags(output());
 229   }
 230 }
 231 
 232 int PrintVMFlagsDCmd::num_arguments() {
 233     ResourceMark rm;
 234     PrintVMFlagsDCmd* dcmd = new PrintVMFlagsDCmd(NULL, false);
 235     if (dcmd != NULL) {
 236       DCmdMark mark(dcmd);
 237       return dcmd->_dcmdparser.num_arguments();
 238     } else {
 239       return 0;
 240     }
 241 }
 242 
 243 SetVMFlagDCmd::SetVMFlagDCmd(outputStream* output, bool heap) :
 244                                    DCmdWithParser(output, heap),
 245   _flag("flag name", "The name of the flag we want to set",
 246         "STRING", true),
 247   _value("string value", "The value we want to set", "STRING", false) {
 248   _dcmdparser.add_dcmd_argument(&_flag);
 249   _dcmdparser.add_dcmd_argument(&_value);
 250 }
 251 
 252 void SetVMFlagDCmd::execute(DCmdSource source, TRAPS) {
 253   const char* val = NULL;
 254   if (_value.value() != NULL) {
 255     val = _value.value();
 256   }
 257 
 258   FormatBuffer<80> err_msg("%s", "");
 259   int ret = WriteableFlags::set_flag(_flag.value(), val, JVMFlag::MANAGEMENT, err_msg);
 260 
 261   if (ret != JVMFlag::SUCCESS) {
 262     output()->print_cr("%s", err_msg.buffer());
 263   }
 264 }
 265 
 266 int SetVMFlagDCmd::num_arguments() {
 267   ResourceMark rm;
 268   SetVMFlagDCmd* dcmd = new SetVMFlagDCmd(NULL, false);
 269   if (dcmd != NULL) {
 270     DCmdMark mark(dcmd);
 271     return dcmd->_dcmdparser.num_arguments();
 272   } else {
 273     return 0;
 274   }
 275 }
 276 
 277 void JVMTIDataDumpDCmd::execute(DCmdSource source, TRAPS) {
 278   if (JvmtiExport::should_post_data_dump()) {
 279     JvmtiExport::post_data_dump();
 280   }
 281 }


src/hotspot/share/services/diagnosticCommand.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File