< 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/metaspace/metaspaceDCmd.hpp"
  41 #include "memory/resourceArea.hpp"
  42 #include "memory/universe.hpp"
  43 #include "nmt/memMapPrinter.hpp"
  44 #include "nmt/memTracker.hpp"
  45 #include "nmt/nmtDCmd.hpp"

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

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












 985 #if INCLUDE_CDS
 986 #define DEFAULT_CDS_ARCHIVE_FILENAME "java_pid%p_<subcmd>.jsa"
 987 
 988 DumpSharedArchiveDCmd::DumpSharedArchiveDCmd(outputStream* output, bool heap) :
 989                                      DCmdWithParser(output, heap),
 990   _suboption("subcmd", "static_dump | dynamic_dump", "STRING", true),
 991   _filename("filename", "Name of shared archive to be dumped", "FILE", false,
 992             DEFAULT_CDS_ARCHIVE_FILENAME)
 993 {
 994   _dcmdparser.add_dcmd_argument(&_suboption);
 995   _dcmdparser.add_dcmd_argument(&_filename);
 996 }
 997 
 998 void DumpSharedArchiveDCmd::execute(DCmdSource source, TRAPS) {
 999   jboolean is_static;
1000   const char* scmd = _suboption.value();
1001 
1002   // The check for _filename.is_set() is because we don't want to use
1003   // DEFAULT_CDS_ARCHIVE_FILENAME, since it is meant as a description
1004   // 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/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 #if INCLUDE_CDS
 139   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<AOTEndTrainingDCmd>(full_export, true, false));
 140 #endif // INCLUDE_CDS
 141 #ifdef LINUX
 142   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PerfMapDCmd>(full_export, true, false));
 143   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TrimCLibcHeapDCmd>(full_export, true, false));
 144   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<MallocInfoDcmd>(full_export, true, false));
 145 #endif // LINUX
 146 #if defined(LINUX) || defined(_WIN64) || defined(__APPLE__)
 147   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemMapDCmd>(full_export, true,false));
 148   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDumpMapDCmd>(full_export, true,false));
 149 #endif // LINUX or WINDOWS or MacOS
 150   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeHeapAnalyticsDCmd>(full_export, true, false));
 151 
 152   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesPrintDCmd>(full_export, true, false));
 153   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesAddDCmd>(full_export, true, false));
 154   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesRemoveDCmd>(full_export, true, false));
 155   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesClearDCmd>(full_export, true, false));
 156   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilationMemoryStatisticDCmd>(full_export, true, false));
 157 
 158   // Enhanced JMX Agent Support
 159   // These commands not currently exported via the DiagnosticCommandMBean
 160   uint32_t jmx_agent_export_flags = DCmd_Source_Internal | DCmd_Source_AttachAPI;

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