1 /*
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
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 *
40 void DCmdRegistrant::register_dcmds(){
41 // Registration of the diagnostic commands
42 // First argument specifies which interfaces will export the command
43 // Second argument specifies if the command is enabled
44 // Third argument specifies if the command is hidden
45 uint32_t full_export = DCmd_Source_Internal | DCmd_Source_AttachAPI
46 | DCmd_Source_MBean;
47 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HelpDCmd>(full_export, true, false));
48 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VersionDCmd>(full_export, true, false));
49 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CommandLineDCmd>(full_export, true, false));
50 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintSystemPropertiesDCmd>(full_export, true, false));
51 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintVMFlagsDCmd>(full_export, true, false));
52 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMDynamicLibrariesDCmd>(full_export, true, false));
53 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMUptimeDCmd>(full_export, true, false));
54 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemGCDCmd>(full_export, true, false));
55 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export, true, false));
56 #if INCLUDE_SERVICES // Heap dumping/inspection supported
57 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
58 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
59 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassStatsDCmd>(full_export, true, false));
60 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false));
61 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false));
62 #endif // INCLUDE_SERVICES
63 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
64 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RotateGCLogDCmd>(full_export, true, false));
65 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
66 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false));
67 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false));
68 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false));
69
70 // Enhanced JMX Agent Support
71 // These commands won't be exported via the DiagnosticCommandMBean until an
72 // appropriate permission is created for them
73 uint32_t jmx_agent_export_flags = DCmd_Source_Internal | DCmd_Source_AttachAPI;
74 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartRemoteDCmd>(jmx_agent_export_flags, true,false));
75 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartLocalDCmd>(jmx_agent_export_flags, true,false));
76 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStopRemoteDCmd>(jmx_agent_export_flags, true,false));
77
78 }
79
678 } else {
679 output()->print_cr("Target VM does not support GC log file rotation.");
680 }
681 }
682
683 void CompileQueueDCmd::execute(DCmdSource source, TRAPS) {
684 VM_PrintCompileQueue printCompileQueueOp(output());
685 VMThread::execute(&printCompileQueueOp);
686 }
687
688 void CodeListDCmd::execute(DCmdSource source, TRAPS) {
689 VM_PrintCodeList printCodeListOp(output());
690 VMThread::execute(&printCodeListOp);
691 }
692
693 void CodeCacheDCmd::execute(DCmdSource source, TRAPS) {
694 VM_PrintCodeCache printCodeCacheOp(output());
695 VMThread::execute(&printCodeCacheOp);
696 }
697
|
1 /*
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
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 *
40 void DCmdRegistrant::register_dcmds(){
41 // Registration of the diagnostic commands
42 // First argument specifies which interfaces will export the command
43 // Second argument specifies if the command is enabled
44 // Third argument specifies if the command is hidden
45 uint32_t full_export = DCmd_Source_Internal | DCmd_Source_AttachAPI
46 | DCmd_Source_MBean;
47 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HelpDCmd>(full_export, true, false));
48 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VersionDCmd>(full_export, true, false));
49 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CommandLineDCmd>(full_export, true, false));
50 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintSystemPropertiesDCmd>(full_export, true, false));
51 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintVMFlagsDCmd>(full_export, true, false));
52 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMDynamicLibrariesDCmd>(full_export, true, false));
53 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMUptimeDCmd>(full_export, true, false));
54 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemGCDCmd>(full_export, true, false));
55 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export, true, false));
56 #if INCLUDE_SERVICES // Heap dumping/inspection supported
57 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
58 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
59 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassStatsDCmd>(full_export, true, false));
60 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHierarchyDCmd>(full_export, true, false));
61 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false));
62 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false));
63 #endif // INCLUDE_SERVICES
64 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
65 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RotateGCLogDCmd>(full_export, true, false));
66 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
67 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false));
68 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false));
69 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false));
70
71 // Enhanced JMX Agent Support
72 // These commands won't be exported via the DiagnosticCommandMBean until an
73 // appropriate permission is created for them
74 uint32_t jmx_agent_export_flags = DCmd_Source_Internal | DCmd_Source_AttachAPI;
75 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartRemoteDCmd>(jmx_agent_export_flags, true,false));
76 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartLocalDCmd>(jmx_agent_export_flags, true,false));
77 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStopRemoteDCmd>(jmx_agent_export_flags, true,false));
78
79 }
80
679 } else {
680 output()->print_cr("Target VM does not support GC log file rotation.");
681 }
682 }
683
684 void CompileQueueDCmd::execute(DCmdSource source, TRAPS) {
685 VM_PrintCompileQueue printCompileQueueOp(output());
686 VMThread::execute(&printCompileQueueOp);
687 }
688
689 void CodeListDCmd::execute(DCmdSource source, TRAPS) {
690 VM_PrintCodeList printCodeListOp(output());
691 VMThread::execute(&printCodeListOp);
692 }
693
694 void CodeCacheDCmd::execute(DCmdSource source, TRAPS) {
695 VM_PrintCodeCache printCodeCacheOp(output());
696 VMThread::execute(&printCodeCacheOp);
697 }
698
699 #if INCLUDE_SERVICES
700 ClassHierarchyDCmd::ClassHierarchyDCmd(outputStream* output, bool heap) :
701 DCmdWithParser(output, heap),
702 _print_interfaces("-i", "Inherited interfaces should be printed.", "BOOLEAN", false, "false"),
703 _print_subclasses("-s", "If a classname is specified, print its subclasses. "
704 "Otherwise only its superclasses are printed.", "BOOLEAN", false, "false"),
705 _classname("classname", "Name of class whose hierarchy should be printed. "
706 "If not specified, all class hierarchies are printed.",
707 "STRING", false) {
708 _dcmdparser.add_dcmd_option(&_print_interfaces);
709 _dcmdparser.add_dcmd_option(&_print_subclasses);
710 _dcmdparser.add_dcmd_argument(&_classname);
711 }
712
713 void ClassHierarchyDCmd::execute(DCmdSource source, TRAPS) {
714 VM_PrintClassHierachry printClassHierarchyOp(output(), _print_interfaces.value(),
715 _print_subclasses.value(), _classname.value());
716 VMThread::execute(&printClassHierarchyOp);
717 }
718
719 int ClassHierarchyDCmd::num_arguments() {
720 ResourceMark rm;
721 ClassHierarchyDCmd* dcmd = new ClassHierarchyDCmd(NULL, false);
722 if (dcmd != NULL) {
723 DCmdMark mark(dcmd);
724 return dcmd->_dcmdparser.num_arguments();
725 } else {
726 return 0;
727 }
728 }
729
730 #endif
|