< prev index next >

src/hotspot/share/services/diagnosticCommand.cpp

Print this page

 102   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CommandLineDCmd>(full_export, true, false));
 103   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintSystemPropertiesDCmd>(full_export, true, false));
 104   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintVMFlagsDCmd>(full_export, true, false));
 105   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SetVMFlagDCmd>(full_export, true, false));
 106   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMDynamicLibrariesDCmd>(full_export, true, false));
 107   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMUptimeDCmd>(full_export, true, false));
 108   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMInfoDCmd>(full_export, true, false));
 109   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemGCDCmd>(full_export, true, false));
 110   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export, true, false));
 111   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapInfoDCmd>(full_export, true, false));
 112   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<FinalizerInfoDCmd>(full_export, true, false));
 113 #if INCLUDE_SERVICES
 114   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
 115   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
 116   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDictionaryDCmd>(full_export, true, false));
 117   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHierarchyDCmd>(full_export, true, false));
 118   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassesDCmd>(full_export, true, false));
 119   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false));
 120   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false));
 121   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<metaspace::MetaspaceDCmd>(full_export, true, false));

 122   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<EventLogDCmd>(full_export, true, false));
 123 #if INCLUDE_JVMTI // Both JVMTI and SERVICES have to be enabled to have this dcmd
 124   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIAgentLoadDCmd>(full_export, true, false));
 125 #endif // INCLUDE_JVMTI
 126 #endif // INCLUDE_SERVICES
 127 #if INCLUDE_JVMTI
 128   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIDataDumpDCmd>(full_export, true, false));
 129 #endif // INCLUDE_JVMTI
 130   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
 131   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpToFileDCmd>(full_export, true, false));
 132   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
 133   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderHierarchyDCmd>(full_export, true, false));
 134   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false));
 135   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false));
 136   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false));
 137 #ifdef LINUX
 138   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PerfMapDCmd>(full_export, true, false));
 139   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TrimCLibcHeapDCmd>(full_export, true, false));
 140   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<MallocInfoDcmd>(full_export, true, false));
 141 #endif // LINUX
 142 #if defined(LINUX) || defined(_WIN64)
 143   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemMapDCmd>(full_export, true,false));
 144   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDumpMapDCmd>(full_export, true,false));
 145 #endif // LINUX or WINDOWS
 146   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeHeapAnalyticsDCmd>(full_export, true, false));
 147 
 148   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesPrintDCmd>(full_export, true, false));
 149   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesAddDCmd>(full_export, true, false));
 150   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesRemoveDCmd>(full_export, true, false));
 151   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesClearDCmd>(full_export, true, false));
 152   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilationMemoryStatisticDCmd>(full_export, true, false));
 153 
 154   // Enhanced JMX Agent Support
 155   // These commands won't be exported via the DiagnosticCommandMBean until an
 156   // appropriate permission is created for them
 157   uint32_t jmx_agent_export_flags = DCmd_Source_Internal | DCmd_Source_AttachAPI;
 158   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartRemoteDCmd>(jmx_agent_export_flags, true,false));
 159   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartLocalDCmd>(jmx_agent_export_flags, true,false));
 160   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStopRemoteDCmd>(jmx_agent_export_flags, true,false));
 161   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStatusDCmd>(jmx_agent_export_flags, true,false));
 162 
 163   // Debug on cmd (only makes sense with JVMTI since the agentlib needs it).
 164 #if INCLUDE_JVMTI
 165   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DebugOnCmdStartDCmd>(full_export, true, true));
 166 #endif // INCLUDE_JVMTI
 167 
 168 #if INCLUDE_CDS
 169   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DumpSharedArchiveDCmd>(full_export, true, false));
 170 #endif // INCLUDE_CDS
 171 
 172   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<NMTDCmd>(full_export, true, false));
 173 }
 174 
 175 HelpDCmd::HelpDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap),
 176   _all("-all", "Show help for all commands", "BOOLEAN", false, "false"),
 177   _cmd("command name", "The name of the command for which we want help",
 178         "STRING", false) {
 179   _dcmdparser.add_dcmd_option(&_all);
 180   _dcmdparser.add_dcmd_argument(&_cmd);
 181 };
 182 

 938 #if INCLUDE_SERVICES
 939 ClassHierarchyDCmd::ClassHierarchyDCmd(outputStream* output, bool heap) :
 940                                        DCmdWithParser(output, heap),
 941   _print_interfaces("-i", "Inherited interfaces should be printed.", "BOOLEAN", false, "false"),
 942   _print_subclasses("-s", "If a classname is specified, print its subclasses "
 943                     "in addition to its superclasses. Without this option only the "
 944                     "superclasses will be printed.", "BOOLEAN", false, "false"),
 945   _classname("classname", "Name of class whose hierarchy should be printed. "
 946              "If not specified, all class hierarchies are printed.",
 947              "STRING", false) {
 948   _dcmdparser.add_dcmd_option(&_print_interfaces);
 949   _dcmdparser.add_dcmd_option(&_print_subclasses);
 950   _dcmdparser.add_dcmd_argument(&_classname);
 951 }
 952 
 953 void ClassHierarchyDCmd::execute(DCmdSource source, TRAPS) {
 954   VM_PrintClassHierarchy printClassHierarchyOp(output(), _print_interfaces.value(),
 955                                                _print_subclasses.value(), _classname.value());
 956   VMThread::execute(&printClassHierarchyOp);
 957 }
 958 #endif
























 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;

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

 163   // Debug on cmd (only makes sense with JVMTI since the agentlib needs it).
 164 #if INCLUDE_JVMTI
 165   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DebugOnCmdStartDCmd>(full_export, true, true));
 166 #endif // INCLUDE_JVMTI
 167 
 168 #if INCLUDE_CDS
 169   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DumpSharedArchiveDCmd>(full_export, true, false));
 170 #endif // INCLUDE_CDS
 171 
 172   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<NMTDCmd>(full_export, true, false));
 173 }
 174 
 175 HelpDCmd::HelpDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap),
 176   _all("-all", "Show help for all commands", "BOOLEAN", false, "false"),
 177   _cmd("command name", "The name of the command for which we want help",
 178         "STRING", false) {
 179   _dcmdparser.add_dcmd_option(&_all);
 180   _dcmdparser.add_dcmd_argument(&_cmd);
 181 };
 182 

 938 #if INCLUDE_SERVICES
 939 ClassHierarchyDCmd::ClassHierarchyDCmd(outputStream* output, bool heap) :
 940                                        DCmdWithParser(output, heap),
 941   _print_interfaces("-i", "Inherited interfaces should be printed.", "BOOLEAN", false, "false"),
 942   _print_subclasses("-s", "If a classname is specified, print its subclasses "
 943                     "in addition to its superclasses. Without this option only the "
 944                     "superclasses will be printed.", "BOOLEAN", false, "false"),
 945   _classname("classname", "Name of class whose hierarchy should be printed. "
 946              "If not specified, all class hierarchies are printed.",
 947              "STRING", false) {
 948   _dcmdparser.add_dcmd_option(&_print_interfaces);
 949   _dcmdparser.add_dcmd_option(&_print_subclasses);
 950   _dcmdparser.add_dcmd_argument(&_classname);
 951 }
 952 
 953 void ClassHierarchyDCmd::execute(DCmdSource source, TRAPS) {
 954   VM_PrintClassHierarchy printClassHierarchyOp(output(), _print_interfaces.value(),
 955                                                _print_subclasses.value(), _classname.value());
 956   VMThread::execute(&printClassHierarchyOp);
 957 }
 958 
 959 PrintClassLayoutDCmd::PrintClassLayoutDCmd(outputStream* output, bool heap) :
 960                                        DCmdWithParser(output, heap),
 961   _classname("classname", "Name of class whose layout should be printed. ",
 962              "STRING", true) {
 963   _dcmdparser.add_dcmd_argument(&_classname);
 964 }
 965 
 966 void PrintClassLayoutDCmd::execute(DCmdSource source, TRAPS) {
 967   VM_PrintClassLayout printClassLayoutOp(output(), _classname.value());
 968   VMThread::execute(&printClassLayoutOp);
 969 }
 970 
 971 int PrintClassLayoutDCmd::num_arguments() {
 972   ResourceMark rm;
 973   PrintClassLayoutDCmd* dcmd = new PrintClassLayoutDCmd(nullptr, false);
 974   if (dcmd != nullptr) {
 975     DCmdMark mark(dcmd);
 976     return dcmd->_dcmdparser.num_arguments();
 977   } else {
 978     return 0;
 979   }
 980 }
 981 
 982 #endif // INCLUDE_SERVICES
 983 
 984 ClassesDCmd::ClassesDCmd(outputStream* output, bool heap) :
 985                                      DCmdWithParser(output, heap),
 986   _verbose("-verbose",
 987            "Dump the detailed content of a Java class. "
 988            "Some classes are annotated with flags: "
 989            "F = has, or inherits, a non-empty finalize method, "
 990            "f = has final method, "
 991            "W = methods rewritten, "
 992            "C = marked with @Contended annotation, "
 993            "R = has been redefined, "
 994            "S = is shared class",
 995            "BOOLEAN", false, "false") {
 996   _dcmdparser.add_dcmd_option(&_verbose);
 997 }
 998 
 999 class VM_PrintClasses : public VM_Operation {
1000 private:
1001   outputStream* _out;
1002   bool _verbose;
< prev index next >