< prev index next >

src/hotspot/share/services/diagnosticCommand.cpp

Print this page

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

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

 913 #if INCLUDE_SERVICES
 914 ClassHierarchyDCmd::ClassHierarchyDCmd(outputStream* output, bool heap) :
 915                                        DCmdWithParser(output, heap),
 916   _print_interfaces("-i", "Inherited interfaces should be printed.", "BOOLEAN", false, "false"),
 917   _print_subclasses("-s", "If a classname is specified, print its subclasses "
 918                     "in addition to its superclasses. Without this option only the "
 919                     "superclasses will be printed.", "BOOLEAN", false, "false"),
 920   _classname("classname", "Name of class whose hierarchy should be printed. "
 921              "If not specified, all class hierarchies are printed.",
 922              "STRING", false) {
 923   _dcmdparser.add_dcmd_option(&_print_interfaces);
 924   _dcmdparser.add_dcmd_option(&_print_subclasses);
 925   _dcmdparser.add_dcmd_argument(&_classname);
 926 }
 927 
 928 void ClassHierarchyDCmd::execute(DCmdSource source, TRAPS) {
 929   VM_PrintClassHierarchy printClassHierarchyOp(output(), _print_interfaces.value(),
 930                                                _print_subclasses.value(), _classname.value());
 931   VMThread::execute(&printClassHierarchyOp);
 932 }
 933 #endif
























 934 
 935 class VM_DumpTouchedMethods : public VM_Operation {
 936 private:
 937   outputStream* _out;
 938 public:
 939   VM_DumpTouchedMethods(outputStream* out) {
 940     _out = out;
 941   }
 942 
 943   virtual VMOp_Type type() const { return VMOp_DumpTouchedMethods; }
 944 
 945   virtual void doit() {
 946     Method::print_touched_methods(_out);
 947   }
 948 };
 949 
 950 void TouchedMethodsDCmd::execute(DCmdSource source, TRAPS) {
 951   if (!LogTouchedMethods) {
 952     output()->print_cr("VM.print_touched_methods command requires -XX:+LogTouchedMethods");
 953     return;

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

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

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