< prev index next >

src/hotspot/share/services/diagnosticCommand.cpp

Print this page

  91   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CommandLineDCmd>(full_export, true, false));
  92   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintSystemPropertiesDCmd>(full_export, true, false));
  93   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintVMFlagsDCmd>(full_export, true, false));
  94   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SetVMFlagDCmd>(full_export, true, false));
  95   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMDynamicLibrariesDCmd>(full_export, true, false));
  96   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMUptimeDCmd>(full_export, true, false));
  97   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMInfoDCmd>(full_export, true, false));
  98   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemGCDCmd>(full_export, true, false));
  99   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export, true, false));
 100   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapInfoDCmd>(full_export, true, false));
 101   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<FinalizerInfoDCmd>(full_export, true, false));
 102 #if INCLUDE_SERVICES
 103   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
 104   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
 105   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDictionaryDCmd>(full_export, true, false));
 106   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHierarchyDCmd>(full_export, true, false));
 107   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassesDCmd>(full_export, true, false));
 108   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false));
 109   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false));
 110   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<metaspace::MetaspaceDCmd>(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<ThreadDumpToFileDCmd>(full_export, true, false));
 121   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
 122   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderHierarchyDCmd>(full_export, true, false));
 123   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false));
 124   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false));
 125   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false));
 126 #ifdef LINUX
 127   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PerfMapDCmd>(full_export, true, false));
 128   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TrimCLibcHeapDCmd>(full_export, true, false));
 129 #endif // LINUX
 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 
 146   // Debug on cmd (only makes sense with JVMTI since the agentlib needs it).
 147 #if INCLUDE_JVMTI
 148   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DebugOnCmdStartDCmd>(full_export, true, true));
 149 #endif // INCLUDE_JVMTI
 150 
 151 #if INCLUDE_CDS
 152   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DumpSharedArchiveDCmd>(full_export, true, false));
 153 #endif // INCLUDE_CDS
 154 }
 155 
 156 #ifndef HAVE_EXTRA_DCMD
 157 void DCmdRegistrant::register_dcmds_ext(){
 158    // Do nothing here
 159 }
 160 #endif
 161 
 162 
 163 HelpDCmd::HelpDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap),
 164   _all("-all", "Show help for all commands", "BOOLEAN", false, "false"),
 165   _cmd("command name", "The name of the command for which we want help",

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
























 935 
 936 ClassesDCmd::ClassesDCmd(outputStream* output, bool heap) :
 937                                      DCmdWithParser(output, heap),
 938   _verbose("-verbose",
 939            "Dump the detailed content of a Java class. "
 940            "Some classes are annotated with flags: "
 941            "F = has, or inherits, a non-empty finalize method, "
 942            "f = has final method, "
 943            "W = methods rewritten, "
 944            "C = marked with @Contended annotation, "
 945            "R = has been redefined, "
 946            "S = is shared class",
 947            "BOOLEAN", false, "false") {
 948   _dcmdparser.add_dcmd_option(&_verbose);
 949 }
 950 
 951 class VM_PrintClasses : public VM_Operation {
 952 private:
 953   outputStream* _out;
 954   bool _verbose;

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

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

 914 #if INCLUDE_SERVICES
 915 ClassHierarchyDCmd::ClassHierarchyDCmd(outputStream* output, bool heap) :
 916                                        DCmdWithParser(output, heap),
 917   _print_interfaces("-i", "Inherited interfaces should be printed.", "BOOLEAN", false, "false"),
 918   _print_subclasses("-s", "If a classname is specified, print its subclasses "
 919                     "in addition to its superclasses. Without this option only the "
 920                     "superclasses will be printed.", "BOOLEAN", false, "false"),
 921   _classname("classname", "Name of class whose hierarchy should be printed. "
 922              "If not specified, all class hierarchies are printed.",
 923              "STRING", false) {
 924   _dcmdparser.add_dcmd_option(&_print_interfaces);
 925   _dcmdparser.add_dcmd_option(&_print_subclasses);
 926   _dcmdparser.add_dcmd_argument(&_classname);
 927 }
 928 
 929 void ClassHierarchyDCmd::execute(DCmdSource source, TRAPS) {
 930   VM_PrintClassHierarchy printClassHierarchyOp(output(), _print_interfaces.value(),
 931                                                _print_subclasses.value(), _classname.value());
 932   VMThread::execute(&printClassHierarchyOp);
 933 }
 934 
 935 PrintClassLayoutDCmd::PrintClassLayoutDCmd(outputStream* output, bool heap) :
 936                                        DCmdWithParser(output, heap),
 937   _classname("classname", "Name of class whose layout should be printed. ",
 938              "STRING", true) {
 939   _dcmdparser.add_dcmd_argument(&_classname);
 940 }
 941 
 942 void PrintClassLayoutDCmd::execute(DCmdSource source, TRAPS) {
 943   VM_PrintClassLayout printClassLayoutOp(output(), _classname.value());
 944   VMThread::execute(&printClassLayoutOp);
 945 }
 946 
 947 int PrintClassLayoutDCmd::num_arguments() {
 948   ResourceMark rm;
 949   PrintClassLayoutDCmd* dcmd = new PrintClassLayoutDCmd(NULL, false);
 950   if (dcmd != NULL) {
 951     DCmdMark mark(dcmd);
 952     return dcmd->_dcmdparser.num_arguments();
 953   } else {
 954     return 0;
 955   }
 956 }
 957 
 958 #endif // INCLUDE_SERVICES
 959 
 960 ClassesDCmd::ClassesDCmd(outputStream* output, bool heap) :
 961                                      DCmdWithParser(output, heap),
 962   _verbose("-verbose",
 963            "Dump the detailed content of a Java class. "
 964            "Some classes are annotated with flags: "
 965            "F = has, or inherits, a non-empty finalize method, "
 966            "f = has final method, "
 967            "W = methods rewritten, "
 968            "C = marked with @Contended annotation, "
 969            "R = has been redefined, "
 970            "S = is shared class",
 971            "BOOLEAN", false, "false") {
 972   _dcmdparser.add_dcmd_option(&_verbose);
 973 }
 974 
 975 class VM_PrintClasses : public VM_Operation {
 976 private:
 977   outputStream* _out;
 978   bool _verbose;
< prev index next >