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/cds_globals.hpp"
26 #include "cds/cdsConfig.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/compileBroker.hpp"
36 #include "compiler/compiler_globals.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/metaspaceUtils.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"
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 #if INCLUDE_JVMTI
132 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpToFileDCmd>(full_export, true, false));
133 #endif // INCLUDE_JVMTI
134 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VThreadSchedulerDCmd>(full_export, true, false));
135 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VThreadPollersDCmd>(full_export, true, false));
136 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
137 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderHierarchyDCmd>(full_export, true, false));
138 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false));
139 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false));
140 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false));
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 #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 "cds/cds_globals.hpp"
26 #include "cds/cdsConfig.hpp"
27 #include "cds/cdsEndTrainingUpcall.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/compileBroker.hpp"
37 #include "compiler/compiler_globals.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/metaspaceUtils.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"
122 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<metaspace::MetaspaceDCmd>(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 #if INCLUDE_JVMTI
133 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpToFileDCmd>(full_export, true, false));
134 #endif // INCLUDE_JVMTI
135 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VThreadSchedulerDCmd>(full_export, true, false));
136 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VThreadPollersDCmd>(full_export, true, false));
137 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
138 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderHierarchyDCmd>(full_export, true, false));
139 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false));
140 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false));
141 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false));
142 #if INCLUDE_CDS
143 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<AOTEndTrainingDCmd>(full_export, true, false));
144 #endif // INCLUDE_CDS
145 #ifdef LINUX
146 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PerfMapDCmd>(full_export, true, false));
147 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TrimCLibcHeapDCmd>(full_export, true, false));
148 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<MallocInfoDcmd>(full_export, true, false));
149 #endif // LINUX
150 #if defined(LINUX) || defined(_WIN64) || defined(__APPLE__)
151 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemMapDCmd>(full_export, true,false));
152 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDumpMapDCmd>(full_export, true,false));
153 #endif // LINUX or WINDOWS or MacOS
154 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeHeapAnalyticsDCmd>(full_export, true, false));
155
156 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesPrintDCmd>(full_export, true, false));
157 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesAddDCmd>(full_export, true, false));
158 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesRemoveDCmd>(full_export, true, false));
159 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesClearDCmd>(full_export, true, false));
160 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilationMemoryStatisticDCmd>(full_export, true, false));
161
162 // Enhanced JMX Agent Support
163 // These commands not currently exported via the DiagnosticCommandMBean
164 uint32_t jmx_agent_export_flags = DCmd_Source_Internal | DCmd_Source_AttachAPI;
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.
|