< 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"

 116   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHierarchyDCmd>(full_export, true, false));
 117   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassesDCmd>(full_export, true, false));
 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<ClassLoaderStatsDCmd>(full_export, true, false));
 132   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderHierarchyDCmd>(full_export, true, false));
 133   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false));
 134   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false));
 135   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false));



 136 #ifdef LINUX
 137   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PerfMapDCmd>(full_export, true, false));
 138   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TrimCLibcHeapDCmd>(full_export, true, false));
 139   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<MallocInfoDcmd>(full_export, true, false));
 140 #endif // LINUX
 141 #if defined(LINUX) || defined(_WIN64)
 142   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemMapDCmd>(full_export, true,false));
 143   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDumpMapDCmd>(full_export, true,false));
 144 #endif // LINUX or WINDOWS
 145   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeHeapAnalyticsDCmd>(full_export, true, false));
 146 
 147   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesPrintDCmd>(full_export, true, false));
 148   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesAddDCmd>(full_export, true, false));
 149   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesRemoveDCmd>(full_export, true, false));
 150   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesClearDCmd>(full_export, true, false));
 151   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilationMemoryStatisticDCmd>(full_export, true, false));
 152 
 153   // Enhanced JMX Agent Support
 154   // These commands won't be exported via the DiagnosticCommandMBean until an
 155   // appropriate permission is created for them

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

 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 #if INCLUDE_CDS
 138   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<AOTEndTrainingDCmd>(full_export, true, false));
 139 #endif // INCLUDE_CDS
 140 #ifdef LINUX
 141   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PerfMapDCmd>(full_export, true, false));
 142   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TrimCLibcHeapDCmd>(full_export, true, false));
 143   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<MallocInfoDcmd>(full_export, true, false));
 144 #endif // LINUX
 145 #if defined(LINUX) || defined(_WIN64)
 146   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemMapDCmd>(full_export, true,false));
 147   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDumpMapDCmd>(full_export, true,false));
 148 #endif // LINUX or WINDOWS
 149   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeHeapAnalyticsDCmd>(full_export, true, false));
 150 
 151   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesPrintDCmd>(full_export, true, false));
 152   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesAddDCmd>(full_export, true, false));
 153   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesRemoveDCmd>(full_export, true, false));
 154   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesClearDCmd>(full_export, true, false));
 155   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilationMemoryStatisticDCmd>(full_export, true, false));
 156 
 157   // Enhanced JMX Agent Support
 158   // These commands won't be exported via the DiagnosticCommandMBean until an
 159   // appropriate permission is created for them

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