< prev index next >

src/hotspot/share/services/diagnosticCommand.cpp

Print this page

   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  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 "cds/cdsConfig.hpp"

  26 #include "cds/cds_globals.hpp"
  27 #include "classfile/classLoaderDataGraph.hpp"
  28 #include "classfile/classLoaderHierarchyDCmd.hpp"
  29 #include "classfile/classLoaderStats.hpp"
  30 #include "classfile/javaClasses.hpp"
  31 #include "classfile/systemDictionary.hpp"
  32 #include "classfile/vmClasses.hpp"
  33 #include "code/codeCache.hpp"
  34 #include "compiler/compilationMemoryStatistic.hpp"
  35 #include "compiler/compiler_globals.hpp"
  36 #include "compiler/compileBroker.hpp"
  37 #include "compiler/directivesParser.hpp"
  38 #include "gc/shared/gcVMOperations.hpp"
  39 #include "jvm.h"
  40 #include "memory/metaspaceUtils.hpp"
  41 #include "memory/metaspace/metaspaceDCmd.hpp"
  42 #include "memory/resourceArea.hpp"
  43 #include "memory/universe.hpp"
  44 #include "nmt/memMapPrinter.hpp"
  45 #include "nmt/memTracker.hpp"

 118   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false));
 119   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false));
 120   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<metaspace::MetaspaceDCmd>(full_export, true, false));
 121   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<EventLogDCmd>(full_export, true, false));
 122 #if INCLUDE_JVMTI // Both JVMTI and SERVICES have to be enabled to have this dcmd
 123   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIAgentLoadDCmd>(full_export, true, false));
 124 #endif // INCLUDE_JVMTI
 125 #endif // INCLUDE_SERVICES
 126 #if INCLUDE_JVMTI
 127   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIDataDumpDCmd>(full_export, true, false));
 128 #endif // INCLUDE_JVMTI
 129   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
 130   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpToFileDCmd>(full_export, true, false));
 131   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VThreadSchedulerDCmd>(full_export, true, false));
 132   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VThreadPollersDCmd>(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) || defined(__APPLE__)
 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 or MacOS
 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 not currently exported via the DiagnosticCommandMBean
 157   uint32_t jmx_agent_export_flags = DCmd_Source_Internal | DCmd_Source_AttachAPI;

 967 class VM_PrintClasses : public VM_Operation {
 968 private:
 969   outputStream* _out;
 970   bool _verbose;
 971 public:
 972   VM_PrintClasses(outputStream* out, bool verbose) : _out(out), _verbose(verbose) {}
 973 
 974   virtual VMOp_Type type() const { return VMOp_PrintClasses; }
 975 
 976   virtual void doit() {
 977     PrintClassClosure closure(_out, _verbose);
 978     ClassLoaderDataGraph::classes_do(&closure);
 979   }
 980 };
 981 
 982 void ClassesDCmd::execute(DCmdSource source, TRAPS) {
 983   VM_PrintClasses vmop(output(), _verbose.value());
 984   VMThread::execute(&vmop);
 985 }
 986 












 987 #if INCLUDE_CDS
 988 #define DEFAULT_CDS_ARCHIVE_FILENAME "java_pid%p_<subcmd>.jsa"
 989 
 990 DumpSharedArchiveDCmd::DumpSharedArchiveDCmd(outputStream* output, bool heap) :
 991                                      DCmdWithParser(output, heap),
 992   _suboption("subcmd", "static_dump | dynamic_dump", "STRING", true),
 993   _filename("filename", "Name of shared archive to be dumped", "FILE", false,
 994             DEFAULT_CDS_ARCHIVE_FILENAME)
 995 {
 996   _dcmdparser.add_dcmd_argument(&_suboption);
 997   _dcmdparser.add_dcmd_argument(&_filename);
 998 }
 999 
1000 void DumpSharedArchiveDCmd::execute(DCmdSource source, TRAPS) {
1001   jboolean is_static;
1002   const char* scmd = _suboption.value();
1003 
1004   // The check for _filename.is_set() is because we don't want to use
1005   // DEFAULT_CDS_ARCHIVE_FILENAME, since it is meant as a description
1006   // of the default, not the actual default.

   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  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 "cds/cdsConfig.hpp"
  26 #include "cds/cdsEndTrainingUpcall.hpp"
  27 #include "cds/cds_globals.hpp"
  28 #include "classfile/classLoaderDataGraph.hpp"
  29 #include "classfile/classLoaderHierarchyDCmd.hpp"
  30 #include "classfile/classLoaderStats.hpp"
  31 #include "classfile/javaClasses.hpp"
  32 #include "classfile/systemDictionary.hpp"
  33 #include "classfile/vmClasses.hpp"
  34 #include "code/codeCache.hpp"
  35 #include "compiler/compilationMemoryStatistic.hpp"
  36 #include "compiler/compiler_globals.hpp"
  37 #include "compiler/compileBroker.hpp"
  38 #include "compiler/directivesParser.hpp"
  39 #include "gc/shared/gcVMOperations.hpp"
  40 #include "jvm.h"
  41 #include "memory/metaspaceUtils.hpp"
  42 #include "memory/metaspace/metaspaceDCmd.hpp"
  43 #include "memory/resourceArea.hpp"
  44 #include "memory/universe.hpp"
  45 #include "nmt/memMapPrinter.hpp"
  46 #include "nmt/memTracker.hpp"

 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<VThreadSchedulerDCmd>(full_export, true, false));
 133   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VThreadPollersDCmd>(full_export, true, false));
 134   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
 135   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderHierarchyDCmd>(full_export, true, false));
 136   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false));
 137   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false));
 138   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false));
 139 #if INCLUDE_CDS
 140   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<AOTEndTrainingDCmd>(full_export, true, false));
 141 #endif // INCLUDE_CDS
 142 #ifdef LINUX
 143   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PerfMapDCmd>(full_export, true, false));
 144   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TrimCLibcHeapDCmd>(full_export, true, false));
 145   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<MallocInfoDcmd>(full_export, true, false));
 146 #endif // LINUX
 147 #if defined(LINUX) || defined(_WIN64) || defined(__APPLE__)
 148   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemMapDCmd>(full_export, true,false));
 149   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDumpMapDCmd>(full_export, true,false));
 150 #endif // LINUX or WINDOWS or MacOS
 151   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeHeapAnalyticsDCmd>(full_export, true, false));
 152 
 153   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesPrintDCmd>(full_export, true, false));
 154   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesAddDCmd>(full_export, true, false));
 155   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesRemoveDCmd>(full_export, true, false));
 156   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesClearDCmd>(full_export, true, false));
 157   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilationMemoryStatisticDCmd>(full_export, true, false));
 158 
 159   // Enhanced JMX Agent Support
 160   // These commands not currently exported via the DiagnosticCommandMBean
 161   uint32_t jmx_agent_export_flags = DCmd_Source_Internal | DCmd_Source_AttachAPI;

 971 class VM_PrintClasses : public VM_Operation {
 972 private:
 973   outputStream* _out;
 974   bool _verbose;
 975 public:
 976   VM_PrintClasses(outputStream* out, bool verbose) : _out(out), _verbose(verbose) {}
 977 
 978   virtual VMOp_Type type() const { return VMOp_PrintClasses; }
 979 
 980   virtual void doit() {
 981     PrintClassClosure closure(_out, _verbose);
 982     ClassLoaderDataGraph::classes_do(&closure);
 983   }
 984 };
 985 
 986 void ClassesDCmd::execute(DCmdSource source, TRAPS) {
 987   VM_PrintClasses vmop(output(), _verbose.value());
 988   VMThread::execute(&vmop);
 989 }
 990 
 991 #if INCLUDE_CDS
 992 void AOTEndTrainingDCmd::execute(DCmdSource source, TRAPS) {
 993   if (!CDSConfig::is_dumping_preimage_static_archive()) {
 994     output()->print_cr("Error! Not a training run");
 995   } else if (CDSEndTrainingUpcall::end_training(THREAD)) {
 996     output()->print_cr("Training ended successfully");
 997   } else {
 998     output()->print_cr("Error! Failed to end training");
 999   }
1000 }
1001 #endif // INCLUDE_CDS
1002 
1003 #if INCLUDE_CDS
1004 #define DEFAULT_CDS_ARCHIVE_FILENAME "java_pid%p_<subcmd>.jsa"
1005 
1006 DumpSharedArchiveDCmd::DumpSharedArchiveDCmd(outputStream* output, bool heap) :
1007                                      DCmdWithParser(output, heap),
1008   _suboption("subcmd", "static_dump | dynamic_dump", "STRING", true),
1009   _filename("filename", "Name of shared archive to be dumped", "FILE", false,
1010             DEFAULT_CDS_ARCHIVE_FILENAME)
1011 {
1012   _dcmdparser.add_dcmd_argument(&_suboption);
1013   _dcmdparser.add_dcmd_argument(&_filename);
1014 }
1015 
1016 void DumpSharedArchiveDCmd::execute(DCmdSource source, TRAPS) {
1017   jboolean is_static;
1018   const char* scmd = _suboption.value();
1019 
1020   // The check for _filename.is_set() is because we don't want to use
1021   // DEFAULT_CDS_ARCHIVE_FILENAME, since it is meant as a description
1022   // of the default, not the actual default.
< prev index next >