< prev index next >

src/hotspot/share/services/diagnosticCommand.cpp

Print this page

   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 "precompiled.hpp"
  26 #include "cds/cdsConfig.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/metaspace/metaspaceDCmd.hpp"
  42 #include "memory/resourceArea.hpp"
  43 #include "memory/universe.hpp"
  44 #include "nmt/memMapPrinter.hpp"
  45 #include "nmt/memTracker.hpp"
  46 #include "nmt/nmtDCmd.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;

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












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

   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 "precompiled.hpp"
  26 #include "cds/cdsConfig.hpp"
  27 #include "cds/cdsEndTrainingUpcall.hpp"
  28 #include "cds/cds_globals.hpp"
  29 #include "classfile/classLoaderDataGraph.hpp"
  30 #include "classfile/classLoaderHierarchyDCmd.hpp"
  31 #include "classfile/classLoaderStats.hpp"
  32 #include "classfile/javaClasses.hpp"
  33 #include "classfile/systemDictionary.hpp"
  34 #include "classfile/vmClasses.hpp"
  35 #include "code/codeCache.hpp"
  36 #include "compiler/compilationMemoryStatistic.hpp"
  37 #include "compiler/compiler_globals.hpp"
  38 #include "compiler/compileBroker.hpp"
  39 #include "compiler/directivesParser.hpp"
  40 #include "gc/shared/gcVMOperations.hpp"
  41 #include "jvm.h"
  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"
  47 #include "nmt/nmtDCmd.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;

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