< prev index next >

src/hotspot/share/services/diagnosticCommand.cpp

Print this page

  87   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VersionDCmd>(full_export, true, false));
  88   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CommandLineDCmd>(full_export, true, false));
  89   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintSystemPropertiesDCmd>(full_export, true, false));
  90   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintVMFlagsDCmd>(full_export, true, false));
  91   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SetVMFlagDCmd>(full_export, true, false));
  92   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMDynamicLibrariesDCmd>(full_export, true, false));
  93   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMUptimeDCmd>(full_export, true, false));
  94   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMInfoDCmd>(full_export, true, false));
  95   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemGCDCmd>(full_export, true, false));
  96   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export, true, false));
  97   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapInfoDCmd>(full_export, true, false));
  98   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<FinalizerInfoDCmd>(full_export, true, false));
  99 #if INCLUDE_SERVICES
 100   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
 101   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
 102   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDictionaryDCmd>(full_export, true, false));
 103   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHierarchyDCmd>(full_export, true, false));
 104   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false));
 105   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false));
 106   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<metaspace::MetaspaceDCmd>(full_export, true, false));

 107   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<EventLogDCmd>(full_export, true, false));
 108 #if INCLUDE_JVMTI // Both JVMTI and SERVICES have to be enabled to have this dcmd
 109   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIAgentLoadDCmd>(full_export, true, false));
 110 #endif // INCLUDE_JVMTI
 111 #endif // INCLUDE_SERVICES
 112 #if INCLUDE_JVMTI
 113   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIDataDumpDCmd>(full_export, true, false));
 114 #endif // INCLUDE_JVMTI
 115   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
 116   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
 117   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderHierarchyDCmd>(full_export, true, false));
 118   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false));
 119   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false));
 120   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false));
 121 #ifdef LINUX
 122   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PerfMapDCmd>(full_export, true, false));
 123   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TrimCLibcHeapDCmd>(full_export, true, false));
 124 #endif // LINUX
 125   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TouchedMethodsDCmd>(full_export, true, false));
 126   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeHeapAnalyticsDCmd>(full_export, true, false));
 127 
 128   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesPrintDCmd>(full_export, true, false));
 129   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesAddDCmd>(full_export, true, false));
 130   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesRemoveDCmd>(full_export, true, false));
 131   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesClearDCmd>(full_export, true, false));
 132 
 133   // Enhanced JMX Agent Support
 134   // These commands won't be exported via the DiagnosticCommandMBean until an
 135   // appropriate permission is created for them
 136   uint32_t jmx_agent_export_flags = DCmd_Source_Internal | DCmd_Source_AttachAPI;
 137   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartRemoteDCmd>(jmx_agent_export_flags, true,false));
 138   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartLocalDCmd>(jmx_agent_export_flags, true,false));
 139   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStopRemoteDCmd>(jmx_agent_export_flags, true,false));
 140   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStatusDCmd>(jmx_agent_export_flags, true,false));
 141 
 142   // Debug on cmd (only makes sense with JVMTI since the agentlib needs it).
 143 #if INCLUDE_JVMTI
 144   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DebugOnCmdStartDCmd>(full_export, true, true));
 145 #endif // INCLUDE_JVMTI
 146 
 147 #if INCLUDE_CDS
 148   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DumpSharedArchiveDCmd>(full_export, true, false));
 149 #endif // INCLUDE_CDS
 150 }
 151 
 152 #ifndef HAVE_EXTRA_DCMD
 153 void DCmdRegistrant::register_dcmds_ext(){
 154    // Do nothing here
 155 }
 156 #endif
 157 
 158 
 159 HelpDCmd::HelpDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap),
 160   _all("-all", "Show help for all commands", "BOOLEAN", false, "false"),
 161   _cmd("command name", "The name of the command for which we want help",

 904 }
 905 #if INCLUDE_SERVICES
 906 ClassHierarchyDCmd::ClassHierarchyDCmd(outputStream* output, bool heap) :
 907                                        DCmdWithParser(output, heap),
 908   _print_interfaces("-i", "Inherited interfaces should be printed.", "BOOLEAN", false, "false"),
 909   _print_subclasses("-s", "If a classname is specified, print its subclasses. "
 910                     "Otherwise only its superclasses are printed.", "BOOLEAN", false, "false"),
 911   _classname("classname", "Name of class whose hierarchy should be printed. "
 912              "If not specified, all class hierarchies are printed.",
 913              "STRING", false) {
 914   _dcmdparser.add_dcmd_option(&_print_interfaces);
 915   _dcmdparser.add_dcmd_option(&_print_subclasses);
 916   _dcmdparser.add_dcmd_argument(&_classname);
 917 }
 918 
 919 void ClassHierarchyDCmd::execute(DCmdSource source, TRAPS) {
 920   VM_PrintClassHierarchy printClassHierarchyOp(output(), _print_interfaces.value(),
 921                                                _print_subclasses.value(), _classname.value());
 922   VMThread::execute(&printClassHierarchyOp);
 923 }
 924 #endif
























 925 
 926 class VM_DumpTouchedMethods : public VM_Operation {
 927 private:
 928   outputStream* _out;
 929 public:
 930   VM_DumpTouchedMethods(outputStream* out) {
 931     _out = out;
 932   }
 933 
 934   virtual VMOp_Type type() const { return VMOp_DumpTouchedMethods; }
 935 
 936   virtual void doit() {
 937     Method::print_touched_methods(_out);
 938   }
 939 };
 940 
 941 void TouchedMethodsDCmd::execute(DCmdSource source, TRAPS) {
 942   if (!LogTouchedMethods) {
 943     output()->print_cr("VM.print_touched_methods command requires -XX:+LogTouchedMethods");
 944     return;

  87   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VersionDCmd>(full_export, true, false));
  88   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CommandLineDCmd>(full_export, true, false));
  89   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintSystemPropertiesDCmd>(full_export, true, false));
  90   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintVMFlagsDCmd>(full_export, true, false));
  91   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SetVMFlagDCmd>(full_export, true, false));
  92   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMDynamicLibrariesDCmd>(full_export, true, false));
  93   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMUptimeDCmd>(full_export, true, false));
  94   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMInfoDCmd>(full_export, true, false));
  95   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemGCDCmd>(full_export, true, false));
  96   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export, true, false));
  97   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapInfoDCmd>(full_export, true, false));
  98   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<FinalizerInfoDCmd>(full_export, true, false));
  99 #if INCLUDE_SERVICES
 100   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
 101   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
 102   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDictionaryDCmd>(full_export, true, false));
 103   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHierarchyDCmd>(full_export, true, false));
 104   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false));
 105   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false));
 106   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<metaspace::MetaspaceDCmd>(full_export, true, false));
 107   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintClassLayoutDCmd>(full_export, true, false));
 108   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<EventLogDCmd>(full_export, true, false));
 109 #if INCLUDE_JVMTI // Both JVMTI and SERVICES have to be enabled to have this dcmd
 110   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIAgentLoadDCmd>(full_export, true, false));
 111 #endif // INCLUDE_JVMTI
 112 #endif // INCLUDE_SERVICES
 113 #if INCLUDE_JVMTI
 114   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIDataDumpDCmd>(full_export, true, false));
 115 #endif // INCLUDE_JVMTI
 116   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
 117   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
 118   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderHierarchyDCmd>(full_export, true, false));
 119   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false));
 120   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false));
 121   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false));
 122 #ifdef LINUX
 123   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PerfMapDCmd>(full_export, true, false));
 124   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TrimCLibcHeapDCmd>(full_export, true, false));
 125 #endif // LINUX
 126   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TouchedMethodsDCmd>(full_export, true, false));
 127   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeHeapAnalyticsDCmd>(full_export, true, false));
 128 
 129   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesPrintDCmd>(full_export, true, false));
 130   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesAddDCmd>(full_export, true, false));
 131   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesRemoveDCmd>(full_export, true, false));
 132   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesClearDCmd>(full_export, true, false));
 133 
 134   // Enhanced JMX Agent Support
 135   // These commands won't be exported via the DiagnosticCommandMBean until an
 136   // appropriate permission is created for them
 137   uint32_t jmx_agent_export_flags = DCmd_Source_Internal | DCmd_Source_AttachAPI;
 138   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartRemoteDCmd>(jmx_agent_export_flags, true,false));
 139   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartLocalDCmd>(jmx_agent_export_flags, true,false));
 140   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStopRemoteDCmd>(jmx_agent_export_flags, true,false));
 141   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStatusDCmd>(jmx_agent_export_flags, true,false));

 142   // Debug on cmd (only makes sense with JVMTI since the agentlib needs it).
 143 #if INCLUDE_JVMTI
 144   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DebugOnCmdStartDCmd>(full_export, true, true));
 145 #endif // INCLUDE_JVMTI
 146 
 147 #if INCLUDE_CDS
 148   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DumpSharedArchiveDCmd>(full_export, true, false));
 149 #endif // INCLUDE_CDS
 150 }
 151 
 152 #ifndef HAVE_EXTRA_DCMD
 153 void DCmdRegistrant::register_dcmds_ext(){
 154    // Do nothing here
 155 }
 156 #endif
 157 
 158 
 159 HelpDCmd::HelpDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap),
 160   _all("-all", "Show help for all commands", "BOOLEAN", false, "false"),
 161   _cmd("command name", "The name of the command for which we want help",

 904 }
 905 #if INCLUDE_SERVICES
 906 ClassHierarchyDCmd::ClassHierarchyDCmd(outputStream* output, bool heap) :
 907                                        DCmdWithParser(output, heap),
 908   _print_interfaces("-i", "Inherited interfaces should be printed.", "BOOLEAN", false, "false"),
 909   _print_subclasses("-s", "If a classname is specified, print its subclasses. "
 910                     "Otherwise only its superclasses are printed.", "BOOLEAN", false, "false"),
 911   _classname("classname", "Name of class whose hierarchy should be printed. "
 912              "If not specified, all class hierarchies are printed.",
 913              "STRING", false) {
 914   _dcmdparser.add_dcmd_option(&_print_interfaces);
 915   _dcmdparser.add_dcmd_option(&_print_subclasses);
 916   _dcmdparser.add_dcmd_argument(&_classname);
 917 }
 918 
 919 void ClassHierarchyDCmd::execute(DCmdSource source, TRAPS) {
 920   VM_PrintClassHierarchy printClassHierarchyOp(output(), _print_interfaces.value(),
 921                                                _print_subclasses.value(), _classname.value());
 922   VMThread::execute(&printClassHierarchyOp);
 923 }
 924 
 925 PrintClassLayoutDCmd::PrintClassLayoutDCmd(outputStream* output, bool heap) :
 926                                        DCmdWithParser(output, heap),
 927   _classname("classname", "Name of class whose layout should be printed. ",
 928              "STRING", true) {
 929   _dcmdparser.add_dcmd_argument(&_classname);
 930 }
 931 
 932 void PrintClassLayoutDCmd::execute(DCmdSource source, TRAPS) {
 933   VM_PrintClassLayout printClassLayoutOp(output(), _classname.value());
 934   VMThread::execute(&printClassLayoutOp);
 935 }
 936 
 937 int PrintClassLayoutDCmd::num_arguments() {
 938   ResourceMark rm;
 939   PrintClassLayoutDCmd* dcmd = new PrintClassLayoutDCmd(NULL, false);
 940   if (dcmd != NULL) {
 941     DCmdMark mark(dcmd);
 942     return dcmd->_dcmdparser.num_arguments();
 943   } else {
 944     return 0;
 945   }
 946 }
 947 
 948 #endif // INCLUDE_SERVICES
 949 
 950 class VM_DumpTouchedMethods : public VM_Operation {
 951 private:
 952   outputStream* _out;
 953 public:
 954   VM_DumpTouchedMethods(outputStream* out) {
 955     _out = out;
 956   }
 957 
 958   virtual VMOp_Type type() const { return VMOp_DumpTouchedMethods; }
 959 
 960   virtual void doit() {
 961     Method::print_touched_methods(_out);
 962   }
 963 };
 964 
 965 void TouchedMethodsDCmd::execute(DCmdSource source, TRAPS) {
 966   if (!LogTouchedMethods) {
 967     output()->print_cr("VM.print_touched_methods command requires -XX:+LogTouchedMethods");
 968     return;
< prev index next >