author | brutisso |
Thu, 10 Dec 2015 14:57:55 +0100 | |
changeset 35061 | be6025ebffea |
parent 34319 | 9d6dd3c5ca23 |
child 35186 | 89076d5121c0 |
permissions | -rw-r--r-- |
11209 | 1 |
/* |
29071
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
2 |
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
11209 | 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 |
* |
|
23 |
*/ |
|
24 |
||
25 |
#include "precompiled.hpp" |
|
25051
8110ec6e7340
8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
24424
diff
changeset
|
26 |
#include "classfile/classLoaderStats.hpp" |
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
26587
diff
changeset
|
27 |
#include "classfile/compactHashtable.hpp" |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
28 |
#include "compiler/compileBroker.hpp" |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
29 |
#include "compiler/directivesParser.hpp" |
30764 | 30 |
#include "gc/shared/vmGCOperations.hpp" |
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28935
diff
changeset
|
31 |
#include "oops/oop.inline.hpp" |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31032
diff
changeset
|
32 |
#include "runtime/globals.hpp" |
11441 | 33 |
#include "runtime/javaCalls.hpp" |
22490
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
34 |
#include "runtime/os.hpp" |
11209 | 35 |
#include "services/diagnosticArgument.hpp" |
36 |
#include "services/diagnosticCommand.hpp" |
|
37 |
#include "services/diagnosticFramework.hpp" |
|
11441 | 38 |
#include "services/heapDumper.hpp" |
39 |
#include "services/management.hpp" |
|
30764 | 40 |
#include "services/writeableFlags.hpp" |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13977
diff
changeset
|
41 |
#include "utilities/macros.hpp" |
32072
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
42 |
#include "oops/objArrayOop.inline.hpp" |
11209 | 43 |
|
11598
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
44 |
void DCmdRegistrant::register_dcmds(){ |
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
45 |
// Registration of the diagnostic commands |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
46 |
// First argument specifies which interfaces will export the command |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
47 |
// Second argument specifies if the command is enabled |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
48 |
// Third argument specifies if the command is hidden |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
49 |
uint32_t full_export = DCmd_Source_Internal | DCmd_Source_AttachAPI |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
50 |
| DCmd_Source_MBean; |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
51 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HelpDCmd>(full_export, true, false)); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
52 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VersionDCmd>(full_export, true, false)); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
53 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CommandLineDCmd>(full_export, true, false)); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
54 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintSystemPropertiesDCmd>(full_export, true, false)); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
55 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintVMFlagsDCmd>(full_export, true, false)); |
30121
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
56 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SetVMFlagDCmd>(full_export, true, false)); |
22490
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
57 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMDynamicLibrariesDCmd>(full_export, true, false)); |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
58 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMUptimeDCmd>(full_export, true, false)); |
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33451
diff
changeset
|
59 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMInfoDCmd>(full_export, true, false)); |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
60 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemGCDCmd>(full_export, true, false)); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
61 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export, true, false)); |
32072
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
62 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapInfoDCmd>(full_export, true, false)); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
63 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<FinalizerInfoDCmd>(full_export, true, false)); |
15437 | 64 |
#if INCLUDE_SERVICES // Heap dumping/inspection supported |
20662
3296bf2cc204
8020789: Disable exporting of gc.heap_dump diagnostic command
sgabdura
parents:
18025
diff
changeset
|
65 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false)); |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
66 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false)); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
67 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassStatsDCmd>(full_export, true, false)); |
29071
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
68 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHierarchyDCmd>(full_export, true, false)); |
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
26587
diff
changeset
|
69 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false)); |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
26587
diff
changeset
|
70 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false)); |
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
71 |
#endif // INCLUDE_SERVICES |
30121
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
72 |
#if INCLUDE_JVMTI |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
73 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIDataDumpDCmd>(full_export, true, false)); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
74 |
#endif // INCLUDE_JVMTI |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
75 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false)); |
25051
8110ec6e7340
8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
24424
diff
changeset
|
76 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false)); |
26587 | 77 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false)); |
78 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false)); |
|
79 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false)); |
|
31790 | 80 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TouchedMethodsDCmd>(full_export, true, false)); |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
81 |
|
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
82 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesPrintDCmd>(full_export, true, false)); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
83 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesAddDCmd>(full_export, true, false)); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
84 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesRemoveDCmd>(full_export, true, false)); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
85 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesClearDCmd>(full_export, true, false)); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
86 |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
87 |
// Enhanced JMX Agent Support |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
88 |
// These commands won't be exported via the DiagnosticCommandMBean until an |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
89 |
// appropriate permission is created for them |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
90 |
uint32_t jmx_agent_export_flags = DCmd_Source_Internal | DCmd_Source_AttachAPI; |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
91 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartRemoteDCmd>(jmx_agent_export_flags, true,false)); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
92 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartLocalDCmd>(jmx_agent_export_flags, true,false)); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
93 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStopRemoteDCmd>(jmx_agent_export_flags, true,false)); |
30134
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
94 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStatusDCmd>(jmx_agent_export_flags, true,false)); |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
95 |
|
11598
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
96 |
} |
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
97 |
|
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
98 |
#ifndef HAVE_EXTRA_DCMD |
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
99 |
void DCmdRegistrant::register_dcmds_ext(){ |
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
100 |
// Do nothing here |
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
101 |
} |
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
102 |
#endif |
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
103 |
|
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
104 |
|
11441 | 105 |
HelpDCmd::HelpDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap), |
11209 | 106 |
_all("-all", "Show help for all commands", "BOOLEAN", false, "false"), |
107 |
_cmd("command name", "The name of the command for which we want help", |
|
108 |
"STRING", false) { |
|
109 |
_dcmdparser.add_dcmd_option(&_all); |
|
110 |
_dcmdparser.add_dcmd_argument(&_cmd); |
|
111 |
}; |
|
112 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
113 |
void HelpDCmd::execute(DCmdSource source, TRAPS) { |
11209 | 114 |
if (_all.value()) { |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
115 |
GrowableArray<const char*>* cmd_list = DCmdFactory::DCmd_list(source); |
11209 | 116 |
for (int i = 0; i < cmd_list->length(); i++) { |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
117 |
DCmdFactory* factory = DCmdFactory::factory(source, cmd_list->at(i), |
11209 | 118 |
strlen(cmd_list->at(i))); |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
119 |
output()->print_cr("%s%s", factory->name(), |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
120 |
factory->is_enabled() ? "" : " [disabled]"); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
121 |
output()->print_cr("\t%s", factory->description()); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
122 |
output()->cr(); |
11209 | 123 |
factory = factory->next(); |
124 |
} |
|
125 |
} else if (_cmd.has_value()) { |
|
126 |
DCmd* cmd = NULL; |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
127 |
DCmdFactory* factory = DCmdFactory::factory(source, _cmd.value(), |
11209 | 128 |
strlen(_cmd.value())); |
129 |
if (factory != NULL) { |
|
130 |
output()->print_cr("%s%s", factory->name(), |
|
131 |
factory->is_enabled() ? "" : " [disabled]"); |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23517
diff
changeset
|
132 |
output()->print_cr("%s", factory->description()); |
11209 | 133 |
output()->print_cr("\nImpact: %s", factory->impact()); |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
134 |
JavaPermission p = factory->permission(); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
135 |
if(p._class != NULL) { |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
136 |
if(p._action != NULL) { |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
137 |
output()->print_cr("\nPermission: %s(%s, %s)", |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
138 |
p._class, p._name == NULL ? "null" : p._name, p._action); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
139 |
} else { |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
140 |
output()->print_cr("\nPermission: %s(%s)", |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
141 |
p._class, p._name == NULL ? "null" : p._name); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
142 |
} |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
143 |
} |
11441 | 144 |
output()->cr(); |
11209 | 145 |
cmd = factory->create_resource_instance(output()); |
146 |
if (cmd != NULL) { |
|
147 |
DCmdMark mark(cmd); |
|
11441 | 148 |
cmd->print_help(factory->name()); |
11209 | 149 |
} |
150 |
} else { |
|
151 |
output()->print_cr("Help unavailable : '%s' : No such command", _cmd.value()); |
|
152 |
} |
|
153 |
} else { |
|
154 |
output()->print_cr("The following commands are available:"); |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
155 |
GrowableArray<const char *>* cmd_list = DCmdFactory::DCmd_list(source); |
11209 | 156 |
for (int i = 0; i < cmd_list->length(); i++) { |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
157 |
DCmdFactory* factory = DCmdFactory::factory(source, cmd_list->at(i), |
11209 | 158 |
strlen(cmd_list->at(i))); |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
159 |
output()->print_cr("%s%s", factory->name(), |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
160 |
factory->is_enabled() ? "" : " [disabled]"); |
11209 | 161 |
factory = factory->_next; |
162 |
} |
|
163 |
output()->print_cr("\nFor more information about a specific command use 'help <command>'."); |
|
164 |
} |
|
165 |
} |
|
166 |
||
167 |
int HelpDCmd::num_arguments() { |
|
168 |
ResourceMark rm; |
|
169 |
HelpDCmd* dcmd = new HelpDCmd(NULL, false); |
|
170 |
if (dcmd != NULL) { |
|
171 |
DCmdMark mark(dcmd); |
|
172 |
return dcmd->_dcmdparser.num_arguments(); |
|
173 |
} else { |
|
174 |
return 0; |
|
175 |
} |
|
176 |
} |
|
177 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
178 |
void VersionDCmd::execute(DCmdSource source, TRAPS) { |
11209 | 179 |
output()->print_cr("%s version %s", Abstract_VM_Version::vm_name(), |
180 |
Abstract_VM_Version::vm_release()); |
|
181 |
JDK_Version jdk_version = JDK_Version::current(); |
|
33959
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
30764
diff
changeset
|
182 |
if (jdk_version.patch_version() > 0) { |
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
30764
diff
changeset
|
183 |
output()->print_cr("JDK %d.%d.%d.%d", jdk_version.major_version(), |
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
30764
diff
changeset
|
184 |
jdk_version.minor_version(), jdk_version.security_version(), |
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
30764
diff
changeset
|
185 |
jdk_version.patch_version()); |
11209 | 186 |
} else { |
33959
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
30764
diff
changeset
|
187 |
output()->print_cr("JDK %d.%d.%d", jdk_version.major_version(), |
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
30764
diff
changeset
|
188 |
jdk_version.minor_version(), jdk_version.security_version()); |
11209 | 189 |
} |
190 |
} |
|
11441 | 191 |
|
192 |
PrintVMFlagsDCmd::PrintVMFlagsDCmd(outputStream* output, bool heap) : |
|
193 |
DCmdWithParser(output, heap), |
|
194 |
_all("-all", "Print all flags supported by the VM", "BOOLEAN", false, "false") { |
|
195 |
_dcmdparser.add_dcmd_option(&_all); |
|
196 |
} |
|
197 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
198 |
void PrintVMFlagsDCmd::execute(DCmdSource source, TRAPS) { |
11441 | 199 |
if (_all.value()) { |
200 |
CommandLineFlags::printFlags(output(), true); |
|
201 |
} else { |
|
202 |
CommandLineFlags::printSetFlags(output()); |
|
203 |
} |
|
204 |
} |
|
205 |
||
206 |
int PrintVMFlagsDCmd::num_arguments() { |
|
207 |
ResourceMark rm; |
|
208 |
PrintVMFlagsDCmd* dcmd = new PrintVMFlagsDCmd(NULL, false); |
|
209 |
if (dcmd != NULL) { |
|
210 |
DCmdMark mark(dcmd); |
|
211 |
return dcmd->_dcmdparser.num_arguments(); |
|
212 |
} else { |
|
213 |
return 0; |
|
214 |
} |
|
215 |
} |
|
216 |
||
30121
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
217 |
SetVMFlagDCmd::SetVMFlagDCmd(outputStream* output, bool heap) : |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
218 |
DCmdWithParser(output, heap), |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
219 |
_flag("flag name", "The name of the flag we want to set", |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
220 |
"STRING", true), |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
221 |
_value("string value", "The value we want to set", "STRING", false) { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
222 |
_dcmdparser.add_dcmd_argument(&_flag); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
223 |
_dcmdparser.add_dcmd_argument(&_value); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
224 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
225 |
|
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
226 |
void SetVMFlagDCmd::execute(DCmdSource source, TRAPS) { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
227 |
const char* val = NULL; |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
228 |
if (_value.value() != NULL) { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
229 |
val = _value.value(); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
230 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
231 |
|
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
232 |
FormatBuffer<80> err_msg("%s", ""); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
233 |
int ret = WriteableFlags::set_flag(_flag.value(), val, Flag::MANAGEMENT, err_msg); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
234 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31032
diff
changeset
|
235 |
if (ret != Flag::SUCCESS) { |
30121
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
236 |
output()->print_cr("%s", err_msg.buffer()); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
237 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
238 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
239 |
|
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
240 |
int SetVMFlagDCmd::num_arguments() { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
241 |
ResourceMark rm; |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
242 |
SetVMFlagDCmd* dcmd = new SetVMFlagDCmd(NULL, false); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
243 |
if (dcmd != NULL) { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
244 |
DCmdMark mark(dcmd); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
245 |
return dcmd->_dcmdparser.num_arguments(); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
246 |
} else { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
247 |
return 0; |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
248 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
249 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
250 |
|
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
251 |
void JVMTIDataDumpDCmd::execute(DCmdSource source, TRAPS) { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
252 |
if (JvmtiExport::should_post_data_dump()) { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
253 |
JvmtiExport::post_data_dump(); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
254 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
255 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
256 |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
257 |
void PrintSystemPropertiesDCmd::execute(DCmdSource source, TRAPS) { |
11441 | 258 |
// load sun.misc.VMSupport |
259 |
Symbol* klass = vmSymbols::sun_misc_VMSupport(); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11953
diff
changeset
|
260 |
Klass* k = SystemDictionary::resolve_or_fail(klass, true, CHECK); |
11441 | 261 |
instanceKlassHandle ik (THREAD, k); |
262 |
if (ik->should_be_initialized()) { |
|
263 |
ik->initialize(THREAD); |
|
264 |
} |
|
265 |
if (HAS_PENDING_EXCEPTION) { |
|
266 |
java_lang_Throwable::print(PENDING_EXCEPTION, output()); |
|
267 |
output()->cr(); |
|
268 |
CLEAR_PENDING_EXCEPTION; |
|
269 |
return; |
|
270 |
} |
|
271 |
||
272 |
// invoke the serializePropertiesToByteArray method |
|
273 |
JavaValue result(T_OBJECT); |
|
274 |
JavaCallArguments args; |
|
275 |
||
276 |
Symbol* signature = vmSymbols::serializePropertiesToByteArray_signature(); |
|
277 |
JavaCalls::call_static(&result, |
|
278 |
ik, |
|
279 |
vmSymbols::serializePropertiesToByteArray_name(), |
|
280 |
signature, |
|
281 |
&args, |
|
282 |
THREAD); |
|
283 |
if (HAS_PENDING_EXCEPTION) { |
|
284 |
java_lang_Throwable::print(PENDING_EXCEPTION, output()); |
|
285 |
output()->cr(); |
|
286 |
CLEAR_PENDING_EXCEPTION; |
|
287 |
return; |
|
288 |
} |
|
289 |
||
290 |
// The result should be a [B |
|
291 |
oop res = (oop)result.get_jobject(); |
|
292 |
assert(res->is_typeArray(), "just checking"); |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
293 |
assert(TypeArrayKlass::cast(res->klass())->element_type() == T_BYTE, "just checking"); |
11441 | 294 |
|
295 |
// copy the bytes to the output stream |
|
296 |
typeArrayOop ba = typeArrayOop(res); |
|
297 |
jbyte* addr = typeArrayOop(res)->byte_at_addr(0); |
|
298 |
output()->print_raw((const char*)addr, ba->length()); |
|
299 |
} |
|
300 |
||
301 |
VMUptimeDCmd::VMUptimeDCmd(outputStream* output, bool heap) : |
|
302 |
DCmdWithParser(output, heap), |
|
303 |
_date("-date", "Add a prefix with current date", "BOOLEAN", false, "false") { |
|
304 |
_dcmdparser.add_dcmd_option(&_date); |
|
305 |
} |
|
306 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
307 |
void VMUptimeDCmd::execute(DCmdSource source, TRAPS) { |
11441 | 308 |
if (_date.value()) { |
309 |
output()->date_stamp(true, "", ": "); |
|
310 |
} |
|
311 |
output()->time_stamp().update_to(tty->time_stamp().ticks()); |
|
312 |
output()->stamp(); |
|
313 |
output()->print_cr(" s"); |
|
314 |
} |
|
315 |
||
316 |
int VMUptimeDCmd::num_arguments() { |
|
317 |
ResourceMark rm; |
|
318 |
VMUptimeDCmd* dcmd = new VMUptimeDCmd(NULL, false); |
|
319 |
if (dcmd != NULL) { |
|
320 |
DCmdMark mark(dcmd); |
|
321 |
return dcmd->_dcmdparser.num_arguments(); |
|
322 |
} else { |
|
323 |
return 0; |
|
324 |
} |
|
325 |
} |
|
326 |
||
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33451
diff
changeset
|
327 |
void VMInfoDCmd::execute(DCmdSource source, TRAPS) { |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33451
diff
changeset
|
328 |
VMError::print_vm_info(_output); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33451
diff
changeset
|
329 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33451
diff
changeset
|
330 |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
331 |
void SystemGCDCmd::execute(DCmdSource source, TRAPS) { |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
332 |
if (!DisableExplicitGC) { |
31032
8e72621ca186
8072913: [REDO] GCCause should distinguish jcmd GC.run from System.gc()
ysuenaga
parents:
30764
diff
changeset
|
333 |
Universe::heap()->collect(GCCause::_dcmd_gc_run); |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
334 |
} else { |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
335 |
output()->print_cr("Explicit GC is disabled, no GC has been performed."); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
336 |
} |
11441 | 337 |
} |
338 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
339 |
void RunFinalizationDCmd::execute(DCmdSource source, TRAPS) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11953
diff
changeset
|
340 |
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), |
11441 | 341 |
true, CHECK); |
342 |
instanceKlassHandle klass(THREAD, k); |
|
343 |
JavaValue result(T_VOID); |
|
344 |
JavaCalls::call_static(&result, klass, |
|
345 |
vmSymbols::run_finalization_name(), |
|
346 |
vmSymbols::void_method_signature(), CHECK); |
|
347 |
} |
|
348 |
||
32072
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
349 |
void HeapInfoDCmd::execute(DCmdSource source, TRAPS) { |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
350 |
Universe::heap()->print_on(output()); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
351 |
} |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
352 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
353 |
void FinalizerInfoDCmd::execute(DCmdSource source, TRAPS) { |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
354 |
ResourceMark rm; |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
355 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
356 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
357 |
Klass* k = SystemDictionary::resolve_or_null( |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
358 |
vmSymbols::finalizer_histogram_klass(), THREAD); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
359 |
assert(k != NULL, "FinalizerHistogram class is not accessible"); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
360 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
361 |
instanceKlassHandle klass(THREAD, k); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
362 |
JavaValue result(T_ARRAY); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
363 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
364 |
// We are calling lang.ref.FinalizerHistogram.getFinalizerHistogram() method |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
365 |
// and expect it to return array of FinalizerHistogramEntry as Object[] |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
366 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
367 |
JavaCalls::call_static(&result, klass, |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
368 |
vmSymbols::get_finalizer_histogram_name(), |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
369 |
vmSymbols::void_finalizer_histogram_entry_array_signature(), CHECK); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
370 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
371 |
objArrayOop result_oop = (objArrayOop) result.get_jobject(); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
372 |
if (result_oop->length() == 0) { |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
373 |
output()->print_cr("No instances waiting for finalization found"); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
374 |
return; |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
375 |
} |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
376 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
377 |
oop foop = result_oop->obj_at(0); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
378 |
InstanceKlass* ik = InstanceKlass::cast(foop->klass()); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
379 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
380 |
fieldDescriptor count_fd, name_fd; |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
381 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
382 |
Klass* count_res = ik->find_field( |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
383 |
vmSymbols::finalizer_histogram_entry_count_field(), vmSymbols::int_signature(), &count_fd); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
384 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
385 |
Klass* name_res = ik->find_field( |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
386 |
vmSymbols::finalizer_histogram_entry_name_field(), vmSymbols::string_signature(), &name_fd); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
387 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
388 |
assert(count_res != NULL && name_res != NULL, "Unexpected layout of FinalizerHistogramEntry"); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
389 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
390 |
output()->print_cr("Unreachable instances waiting for finalization"); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
391 |
output()->print_cr("#instances class name"); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
392 |
output()->print_cr("-----------------------"); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
393 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
394 |
for (int i = 0; i < result_oop->length(); ++i) { |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
395 |
oop element_oop = result_oop->obj_at(i); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
396 |
oop str_oop = element_oop->obj_field(name_fd.offset()); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
397 |
char *name = java_lang_String::as_utf8_string(str_oop); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
398 |
int count = element_oop->int_field(count_fd.offset()); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
399 |
output()->print_cr("%10d %s", count, name); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
400 |
} |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
401 |
} |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
402 |
|
15437 | 403 |
#if INCLUDE_SERVICES // Heap dumping/inspection supported |
11441 | 404 |
HeapDumpDCmd::HeapDumpDCmd(outputStream* output, bool heap) : |
405 |
DCmdWithParser(output, heap), |
|
406 |
_filename("filename","Name of the dump file", "STRING",true), |
|
407 |
_all("-all", "Dump all objects, including unreachable objects", |
|
408 |
"BOOLEAN", false, "false") { |
|
409 |
_dcmdparser.add_dcmd_option(&_all); |
|
410 |
_dcmdparser.add_dcmd_argument(&_filename); |
|
411 |
} |
|
412 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
413 |
void HeapDumpDCmd::execute(DCmdSource source, TRAPS) { |
11441 | 414 |
// Request a full GC before heap dump if _all is false |
415 |
// This helps reduces the amount of unreachable objects in the dump |
|
416 |
// and makes it easier to browse. |
|
417 |
HeapDumper dumper(!_all.value() /* request GC if _all is false*/); |
|
418 |
int res = dumper.dump(_filename.value()); |
|
419 |
if (res == 0) { |
|
420 |
output()->print_cr("Heap dump file created"); |
|
421 |
} else { |
|
422 |
// heap dump failed |
|
423 |
ResourceMark rm; |
|
424 |
char* error = dumper.error_as_C_string(); |
|
425 |
if (error == NULL) { |
|
426 |
output()->print_cr("Dump failed - reason unknown"); |
|
427 |
} else { |
|
428 |
output()->print_cr("%s", error); |
|
429 |
} |
|
430 |
} |
|
431 |
} |
|
432 |
||
433 |
int HeapDumpDCmd::num_arguments() { |
|
434 |
ResourceMark rm; |
|
435 |
HeapDumpDCmd* dcmd = new HeapDumpDCmd(NULL, false); |
|
436 |
if (dcmd != NULL) { |
|
437 |
DCmdMark mark(dcmd); |
|
438 |
return dcmd->_dcmdparser.num_arguments(); |
|
439 |
} else { |
|
440 |
return 0; |
|
441 |
} |
|
442 |
} |
|
443 |
||
444 |
ClassHistogramDCmd::ClassHistogramDCmd(outputStream* output, bool heap) : |
|
445 |
DCmdWithParser(output, heap), |
|
446 |
_all("-all", "Inspect all objects, including unreachable objects", |
|
447 |
"BOOLEAN", false, "false") { |
|
448 |
_dcmdparser.add_dcmd_option(&_all); |
|
449 |
} |
|
450 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
451 |
void ClassHistogramDCmd::execute(DCmdSource source, TRAPS) { |
11441 | 452 |
VM_GC_HeapInspection heapop(output(), |
18025 | 453 |
!_all.value() /* request full gc if false */); |
11441 | 454 |
VMThread::execute(&heapop); |
455 |
} |
|
456 |
||
457 |
int ClassHistogramDCmd::num_arguments() { |
|
458 |
ResourceMark rm; |
|
459 |
ClassHistogramDCmd* dcmd = new ClassHistogramDCmd(NULL, false); |
|
460 |
if (dcmd != NULL) { |
|
461 |
DCmdMark mark(dcmd); |
|
462 |
return dcmd->_dcmdparser.num_arguments(); |
|
463 |
} else { |
|
464 |
return 0; |
|
465 |
} |
|
466 |
} |
|
467 |
||
15437 | 468 |
#define DEFAULT_COLUMNS "InstBytes,KlassBytes,CpAll,annotations,MethodCount,Bytecodes,MethodAll,ROAll,RWAll,Total" |
469 |
ClassStatsDCmd::ClassStatsDCmd(outputStream* output, bool heap) : |
|
470 |
DCmdWithParser(output, heap), |
|
471 |
_csv("-csv", "Print in CSV (comma-separated values) format for spreadsheets", |
|
472 |
"BOOLEAN", false, "false"), |
|
473 |
_all("-all", "Show all columns", |
|
474 |
"BOOLEAN", false, "false"), |
|
475 |
_help("-help", "Show meaning of all the columns", |
|
476 |
"BOOLEAN", false, "false"), |
|
477 |
_columns("columns", "Comma-separated list of all the columns to show. " |
|
478 |
"If not specified, the following columns are shown: " DEFAULT_COLUMNS, |
|
479 |
"STRING", false) { |
|
480 |
_dcmdparser.add_dcmd_option(&_all); |
|
481 |
_dcmdparser.add_dcmd_option(&_csv); |
|
482 |
_dcmdparser.add_dcmd_option(&_help); |
|
483 |
_dcmdparser.add_dcmd_argument(&_columns); |
|
484 |
} |
|
485 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
486 |
void ClassStatsDCmd::execute(DCmdSource source, TRAPS) { |
15437 | 487 |
if (!UnlockDiagnosticVMOptions) { |
488 |
output()->print_cr("GC.class_stats command requires -XX:+UnlockDiagnosticVMOptions"); |
|
489 |
return; |
|
490 |
} |
|
491 |
||
492 |
VM_GC_HeapInspection heapop(output(), |
|
18025 | 493 |
true /* request_full_gc */); |
15437 | 494 |
heapop.set_csv_format(_csv.value()); |
495 |
heapop.set_print_help(_help.value()); |
|
496 |
heapop.set_print_class_stats(true); |
|
497 |
if (_all.value()) { |
|
498 |
if (_columns.has_value()) { |
|
499 |
output()->print_cr("Cannot specify -all and individual columns at the same time"); |
|
500 |
return; |
|
501 |
} else { |
|
502 |
heapop.set_columns(NULL); |
|
503 |
} |
|
504 |
} else { |
|
505 |
if (_columns.has_value()) { |
|
506 |
heapop.set_columns(_columns.value()); |
|
507 |
} else { |
|
508 |
heapop.set_columns(DEFAULT_COLUMNS); |
|
509 |
} |
|
510 |
} |
|
511 |
VMThread::execute(&heapop); |
|
512 |
} |
|
513 |
||
514 |
int ClassStatsDCmd::num_arguments() { |
|
515 |
ResourceMark rm; |
|
516 |
ClassStatsDCmd* dcmd = new ClassStatsDCmd(NULL, false); |
|
517 |
if (dcmd != NULL) { |
|
518 |
DCmdMark mark(dcmd); |
|
519 |
return dcmd->_dcmdparser.num_arguments(); |
|
520 |
} else { |
|
521 |
return 0; |
|
522 |
} |
|
523 |
} |
|
524 |
#endif // INCLUDE_SERVICES |
|
525 |
||
11441 | 526 |
ThreadDumpDCmd::ThreadDumpDCmd(outputStream* output, bool heap) : |
527 |
DCmdWithParser(output, heap), |
|
528 |
_locks("-l", "print java.util.concurrent locks", "BOOLEAN", false, "false") { |
|
529 |
_dcmdparser.add_dcmd_option(&_locks); |
|
530 |
} |
|
531 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
532 |
void ThreadDumpDCmd::execute(DCmdSource source, TRAPS) { |
11441 | 533 |
// thread stacks |
534 |
VM_PrintThreads op1(output(), _locks.value()); |
|
535 |
VMThread::execute(&op1); |
|
536 |
||
537 |
// JNI global handles |
|
538 |
VM_PrintJNI op2(output()); |
|
539 |
VMThread::execute(&op2); |
|
540 |
||
541 |
// Deadlock detection |
|
542 |
VM_FindDeadlocks op3(output()); |
|
543 |
VMThread::execute(&op3); |
|
544 |
} |
|
545 |
||
546 |
int ThreadDumpDCmd::num_arguments() { |
|
547 |
ResourceMark rm; |
|
548 |
ThreadDumpDCmd* dcmd = new ThreadDumpDCmd(NULL, false); |
|
549 |
if (dcmd != NULL) { |
|
550 |
DCmdMark mark(dcmd); |
|
551 |
return dcmd->_dcmdparser.num_arguments(); |
|
552 |
} else { |
|
553 |
return 0; |
|
554 |
} |
|
555 |
} |
|
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
556 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
557 |
// Enhanced JMX Agent support |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
558 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
559 |
JMXStartRemoteDCmd::JMXStartRemoteDCmd(outputStream *output, bool heap_allocated) : |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
560 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
561 |
DCmdWithParser(output, heap_allocated), |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
562 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
563 |
_config_file |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
564 |
("config.file", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
565 |
"set com.sun.management.config.file", "STRING", false), |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
566 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
567 |
_jmxremote_port |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
568 |
("jmxremote.port", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
569 |
"set com.sun.management.jmxremote.port", "STRING", false), |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
570 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
571 |
_jmxremote_rmi_port |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
572 |
("jmxremote.rmi.port", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
573 |
"set com.sun.management.jmxremote.rmi.port", "STRING", false), |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
574 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
575 |
_jmxremote_ssl |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
576 |
("jmxremote.ssl", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
577 |
"set com.sun.management.jmxremote.ssl", "STRING", false), |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
578 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
579 |
_jmxremote_registry_ssl |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
580 |
("jmxremote.registry.ssl", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
581 |
"set com.sun.management.jmxremote.registry.ssl", "STRING", false), |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
582 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
583 |
_jmxremote_authenticate |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
584 |
("jmxremote.authenticate", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
585 |
"set com.sun.management.jmxremote.authenticate", "STRING", false), |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
586 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
587 |
_jmxremote_password_file |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
588 |
("jmxremote.password.file", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
589 |
"set com.sun.management.jmxremote.password.file", "STRING", false), |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
590 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
591 |
_jmxremote_access_file |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
592 |
("jmxremote.access.file", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
593 |
"set com.sun.management.jmxremote.access.file", "STRING", false), |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
594 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
595 |
_jmxremote_login_config |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
596 |
("jmxremote.login.config", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
597 |
"set com.sun.management.jmxremote.login.config", "STRING", false), |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
598 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
599 |
_jmxremote_ssl_enabled_cipher_suites |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
600 |
("jmxremote.ssl.enabled.cipher.suites", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
601 |
"set com.sun.management.jmxremote.ssl.enabled.cipher.suite", "STRING", false), |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
602 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
603 |
_jmxremote_ssl_enabled_protocols |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
604 |
("jmxremote.ssl.enabled.protocols", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
605 |
"set com.sun.management.jmxremote.ssl.enabled.protocols", "STRING", false), |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
606 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
607 |
_jmxremote_ssl_need_client_auth |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
608 |
("jmxremote.ssl.need.client.auth", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
609 |
"set com.sun.management.jmxremote.need.client.auth", "STRING", false), |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
610 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
611 |
_jmxremote_ssl_config_file |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
612 |
("jmxremote.ssl.config.file", |
15460
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
613 |
"set com.sun.management.jmxremote.ssl_config_file", "STRING", false), |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
614 |
|
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
615 |
// JDP Protocol support |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
616 |
_jmxremote_autodiscovery |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
617 |
("jmxremote.autodiscovery", |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
618 |
"set com.sun.management.jmxremote.autodiscovery", "STRING", false), |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
619 |
|
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
620 |
_jdp_port |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
621 |
("jdp.port", |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
622 |
"set com.sun.management.jdp.port", "INT", false), |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
623 |
|
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
624 |
_jdp_address |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
625 |
("jdp.address", |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
626 |
"set com.sun.management.jdp.address", "STRING", false), |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
627 |
|
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
628 |
_jdp_source_addr |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
629 |
("jdp.source_addr", |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
630 |
"set com.sun.management.jdp.source_addr", "STRING", false), |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
631 |
|
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
632 |
_jdp_ttl |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
633 |
("jdp.ttl", |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
634 |
"set com.sun.management.jdp.ttl", "INT", false), |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
635 |
|
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
636 |
_jdp_pause |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
637 |
("jdp.pause", |
21076
7cea9d36a46e
8026930: In ManagementAgent.start it should be possible to set the jdp.name parameter (hotspot part)
dsamersoff
parents:
18025
diff
changeset
|
638 |
"set com.sun.management.jdp.pause", "INT", false), |
7cea9d36a46e
8026930: In ManagementAgent.start it should be possible to set the jdp.name parameter (hotspot part)
dsamersoff
parents:
18025
diff
changeset
|
639 |
|
7cea9d36a46e
8026930: In ManagementAgent.start it should be possible to set the jdp.name parameter (hotspot part)
dsamersoff
parents:
18025
diff
changeset
|
640 |
_jdp_name |
7cea9d36a46e
8026930: In ManagementAgent.start it should be possible to set the jdp.name parameter (hotspot part)
dsamersoff
parents:
18025
diff
changeset
|
641 |
("jdp.name", |
7cea9d36a46e
8026930: In ManagementAgent.start it should be possible to set the jdp.name parameter (hotspot part)
dsamersoff
parents:
18025
diff
changeset
|
642 |
"set com.sun.management.jdp.name", "STRING", false) |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
643 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
644 |
{ |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
645 |
_dcmdparser.add_dcmd_option(&_config_file); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
646 |
_dcmdparser.add_dcmd_option(&_jmxremote_port); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
647 |
_dcmdparser.add_dcmd_option(&_jmxremote_rmi_port); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
648 |
_dcmdparser.add_dcmd_option(&_jmxremote_ssl); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
649 |
_dcmdparser.add_dcmd_option(&_jmxremote_registry_ssl); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
650 |
_dcmdparser.add_dcmd_option(&_jmxremote_authenticate); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
651 |
_dcmdparser.add_dcmd_option(&_jmxremote_password_file); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
652 |
_dcmdparser.add_dcmd_option(&_jmxremote_access_file); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
653 |
_dcmdparser.add_dcmd_option(&_jmxremote_login_config); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
654 |
_dcmdparser.add_dcmd_option(&_jmxremote_ssl_enabled_cipher_suites); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
655 |
_dcmdparser.add_dcmd_option(&_jmxremote_ssl_enabled_protocols); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
656 |
_dcmdparser.add_dcmd_option(&_jmxremote_ssl_need_client_auth); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
657 |
_dcmdparser.add_dcmd_option(&_jmxremote_ssl_config_file); |
15460
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
658 |
_dcmdparser.add_dcmd_option(&_jmxremote_autodiscovery); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
659 |
_dcmdparser.add_dcmd_option(&_jdp_port); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
660 |
_dcmdparser.add_dcmd_option(&_jdp_address); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
661 |
_dcmdparser.add_dcmd_option(&_jdp_source_addr); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
662 |
_dcmdparser.add_dcmd_option(&_jdp_ttl); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
663 |
_dcmdparser.add_dcmd_option(&_jdp_pause); |
21076
7cea9d36a46e
8026930: In ManagementAgent.start it should be possible to set the jdp.name parameter (hotspot part)
dsamersoff
parents:
18025
diff
changeset
|
664 |
_dcmdparser.add_dcmd_option(&_jdp_name); |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
665 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
666 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
667 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
668 |
int JMXStartRemoteDCmd::num_arguments() { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
669 |
ResourceMark rm; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
670 |
JMXStartRemoteDCmd* dcmd = new JMXStartRemoteDCmd(NULL, false); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
671 |
if (dcmd != NULL) { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
672 |
DCmdMark mark(dcmd); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
673 |
return dcmd->_dcmdparser.num_arguments(); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
674 |
} else { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
675 |
return 0; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
676 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
677 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
678 |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
679 |
|
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
680 |
void JMXStartRemoteDCmd::execute(DCmdSource source, TRAPS) { |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
681 |
ResourceMark rm(THREAD); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
682 |
HandleMark hm(THREAD); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
683 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
684 |
// Load and initialize the sun.management.Agent class |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
685 |
// invoke startRemoteManagementAgent(string) method to start |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
686 |
// the remote management server. |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
687 |
// throw java.lang.NoSuchMethodError if the method doesn't exist |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
688 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
689 |
Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11953
diff
changeset
|
690 |
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::sun_management_Agent(), loader, Handle(), true, CHECK); |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
691 |
instanceKlassHandle ik (THREAD, k); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
692 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
693 |
JavaValue result(T_VOID); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
694 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
695 |
// Pass all command line arguments to java as key=value,... |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
696 |
// All checks are done on java side |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
697 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
698 |
int len = 0; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
699 |
stringStream options; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
700 |
char comma[2] = {0,0}; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
701 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
702 |
// Leave default values on Agent.class side and pass only |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
703 |
// agruments explicitly set by user. All arguments passed |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
704 |
// to jcmd override properties with the same name set by |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
705 |
// command line with -D or by managmenent.properties |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
706 |
// file. |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
707 |
#define PUT_OPTION(a) \ |
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
708 |
do { \ |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
709 |
if ( (a).is_set() ){ \ |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
710 |
if ( *((a).type()) == 'I' ) { \ |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
711 |
options.print("%scom.sun.management.%s=" JLONG_FORMAT, comma, (a).name(), (jlong)((a).value())); \ |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
712 |
} else { \ |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
713 |
options.print("%scom.sun.management.%s=%s", comma, (a).name(), (char*)((a).value())); \ |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
714 |
} \ |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
715 |
comma[0] = ','; \ |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
716 |
}\ |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
717 |
} while(0); |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
718 |
|
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
719 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
720 |
PUT_OPTION(_config_file); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
721 |
PUT_OPTION(_jmxremote_port); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
722 |
PUT_OPTION(_jmxremote_rmi_port); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
723 |
PUT_OPTION(_jmxremote_ssl); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
724 |
PUT_OPTION(_jmxremote_registry_ssl); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
725 |
PUT_OPTION(_jmxremote_authenticate); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
726 |
PUT_OPTION(_jmxremote_password_file); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
727 |
PUT_OPTION(_jmxremote_access_file); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
728 |
PUT_OPTION(_jmxremote_login_config); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
729 |
PUT_OPTION(_jmxremote_ssl_enabled_cipher_suites); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
730 |
PUT_OPTION(_jmxremote_ssl_enabled_protocols); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
731 |
PUT_OPTION(_jmxremote_ssl_need_client_auth); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
732 |
PUT_OPTION(_jmxremote_ssl_config_file); |
15460
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
733 |
PUT_OPTION(_jmxremote_autodiscovery); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
734 |
PUT_OPTION(_jdp_port); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
735 |
PUT_OPTION(_jdp_address); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
736 |
PUT_OPTION(_jdp_source_addr); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
737 |
PUT_OPTION(_jdp_ttl); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
738 |
PUT_OPTION(_jdp_pause); |
21076
7cea9d36a46e
8026930: In ManagementAgent.start it should be possible to set the jdp.name parameter (hotspot part)
dsamersoff
parents:
18025
diff
changeset
|
739 |
PUT_OPTION(_jdp_name); |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
740 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
741 |
#undef PUT_OPTION |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
742 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
743 |
Handle str = java_lang_String::create_from_str(options.as_string(), CHECK); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
744 |
JavaCalls::call_static(&result, ik, vmSymbols::startRemoteAgent_name(), vmSymbols::string_void_signature(), str, CHECK); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
745 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
746 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
747 |
JMXStartLocalDCmd::JMXStartLocalDCmd(outputStream *output, bool heap_allocated) : |
22490
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
748 |
DCmd(output, heap_allocated) { |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
749 |
// do nothing |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
750 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
751 |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
752 |
void JMXStartLocalDCmd::execute(DCmdSource source, TRAPS) { |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
753 |
ResourceMark rm(THREAD); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
754 |
HandleMark hm(THREAD); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
755 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
756 |
// Load and initialize the sun.management.Agent class |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
757 |
// invoke startLocalManagementAgent(void) method to start |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
758 |
// the local management server |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
759 |
// throw java.lang.NoSuchMethodError if method doesn't exist |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
760 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
761 |
Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11953
diff
changeset
|
762 |
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::sun_management_Agent(), loader, Handle(), true, CHECK); |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
763 |
instanceKlassHandle ik (THREAD, k); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
764 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
765 |
JavaValue result(T_VOID); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
766 |
JavaCalls::call_static(&result, ik, vmSymbols::startLocalAgent_name(), vmSymbols::void_method_signature(), CHECK); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
767 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
768 |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
769 |
void JMXStopRemoteDCmd::execute(DCmdSource source, TRAPS) { |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
770 |
ResourceMark rm(THREAD); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
771 |
HandleMark hm(THREAD); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
772 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
773 |
// Load and initialize the sun.management.Agent class |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
774 |
// invoke stopRemoteManagementAgent method to stop the |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
775 |
// management server |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
776 |
// throw java.lang.NoSuchMethodError if method doesn't exist |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
777 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
778 |
Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11953
diff
changeset
|
779 |
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::sun_management_Agent(), loader, Handle(), true, CHECK); |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
780 |
instanceKlassHandle ik (THREAD, k); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
781 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
782 |
JavaValue result(T_VOID); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
783 |
JavaCalls::call_static(&result, ik, vmSymbols::stopRemoteAgent_name(), vmSymbols::void_method_signature(), CHECK); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
784 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
785 |
|
30134
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
786 |
JMXStatusDCmd::JMXStatusDCmd(outputStream *output, bool heap_allocated) : |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
787 |
DCmd(output, heap_allocated) { |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
788 |
// do nothing |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
789 |
} |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
790 |
|
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
791 |
void JMXStatusDCmd::execute(DCmdSource source, TRAPS) { |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
792 |
ResourceMark rm(THREAD); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
793 |
HandleMark hm(THREAD); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
794 |
|
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
795 |
// Load and initialize the sun.management.Agent class |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
796 |
// invoke getManagementAgentStatus() method to generate the status info |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
797 |
// throw java.lang.NoSuchMethodError if method doesn't exist |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
798 |
|
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
799 |
Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
800 |
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::sun_management_Agent(), loader, Handle(), true, CHECK); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
801 |
instanceKlassHandle ik (THREAD, k); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
802 |
|
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
803 |
JavaValue result(T_OBJECT); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
804 |
JavaCalls::call_static(&result, ik, vmSymbols::getAgentStatus_name(), vmSymbols::void_string_signature(), CHECK); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
805 |
|
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
806 |
jvalue* jv = (jvalue*) result.get_value_addr(); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
807 |
oop str = (oop) jv->l; |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
808 |
if (str != NULL) { |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
809 |
char* out = java_lang_String::as_utf8_string(str); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
810 |
if (out) { |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
811 |
output()->print_cr("%s", out); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
812 |
return; |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
813 |
} |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
814 |
} |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
815 |
output()->print_cr("Error obtaining management agent status"); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
816 |
} |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
817 |
|
22490
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
818 |
VMDynamicLibrariesDCmd::VMDynamicLibrariesDCmd(outputStream *output, bool heap_allocated) : |
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
819 |
DCmd(output, heap_allocated) { |
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
820 |
// do nothing |
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
821 |
} |
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
822 |
|
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
823 |
void VMDynamicLibrariesDCmd::execute(DCmdSource source, TRAPS) { |
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
824 |
os::print_dll_info(output()); |
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
825 |
output()->cr(); |
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
826 |
} |
23517 | 827 |
|
26587 | 828 |
void CompileQueueDCmd::execute(DCmdSource source, TRAPS) { |
829 |
VM_PrintCompileQueue printCompileQueueOp(output()); |
|
830 |
VMThread::execute(&printCompileQueueOp); |
|
831 |
} |
|
832 |
||
833 |
void CodeListDCmd::execute(DCmdSource source, TRAPS) { |
|
834 |
VM_PrintCodeList printCodeListOp(output()); |
|
835 |
VMThread::execute(&printCodeListOp); |
|
836 |
} |
|
837 |
||
838 |
void CodeCacheDCmd::execute(DCmdSource source, TRAPS) { |
|
839 |
VM_PrintCodeCache printCodeCacheOp(output()); |
|
840 |
VMThread::execute(&printCodeCacheOp); |
|
841 |
} |
|
842 |
||
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
843 |
void CompilerDirectivesPrintDCmd::execute(DCmdSource source, TRAPS) { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
844 |
DirectivesStack::print(output()); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
845 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
846 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
847 |
CompilerDirectivesAddDCmd::CompilerDirectivesAddDCmd(outputStream* output, bool heap) : |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
848 |
DCmdWithParser(output, heap), |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
849 |
_filename("filename","Name of the directives file", "STRING",true) { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
850 |
_dcmdparser.add_dcmd_argument(&_filename); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
851 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
852 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
853 |
void CompilerDirectivesAddDCmd::execute(DCmdSource source, TRAPS) { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
854 |
DirectivesParser::parse_from_file(_filename.value(), output()); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
855 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
856 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
857 |
int CompilerDirectivesAddDCmd::num_arguments() { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
858 |
ResourceMark rm; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
859 |
CompilerDirectivesAddDCmd* dcmd = new CompilerDirectivesAddDCmd(NULL, false); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
860 |
if (dcmd != NULL) { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
861 |
DCmdMark mark(dcmd); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
862 |
return dcmd->_dcmdparser.num_arguments(); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
863 |
} else { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
864 |
return 0; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
865 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
866 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
867 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
868 |
void CompilerDirectivesRemoveDCmd::execute(DCmdSource source, TRAPS) { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
869 |
DirectivesStack::pop(); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
870 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
871 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
872 |
void CompilerDirectivesClearDCmd::execute(DCmdSource source, TRAPS) { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
873 |
DirectivesStack::clear(); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
874 |
} |
29071
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
875 |
#if INCLUDE_SERVICES |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
876 |
ClassHierarchyDCmd::ClassHierarchyDCmd(outputStream* output, bool heap) : |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
877 |
DCmdWithParser(output, heap), |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
878 |
_print_interfaces("-i", "Inherited interfaces should be printed.", "BOOLEAN", false, "false"), |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
879 |
_print_subclasses("-s", "If a classname is specified, print its subclasses. " |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
880 |
"Otherwise only its superclasses are printed.", "BOOLEAN", false, "false"), |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
881 |
_classname("classname", "Name of class whose hierarchy should be printed. " |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
882 |
"If not specified, all class hierarchies are printed.", |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
883 |
"STRING", false) { |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
884 |
_dcmdparser.add_dcmd_option(&_print_interfaces); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
885 |
_dcmdparser.add_dcmd_option(&_print_subclasses); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
886 |
_dcmdparser.add_dcmd_argument(&_classname); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
887 |
} |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
888 |
|
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
889 |
void ClassHierarchyDCmd::execute(DCmdSource source, TRAPS) { |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
890 |
VM_PrintClassHierarchy printClassHierarchyOp(output(), _print_interfaces.value(), |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
891 |
_print_subclasses.value(), _classname.value()); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
892 |
VMThread::execute(&printClassHierarchyOp); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
893 |
} |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
894 |
|
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
895 |
int ClassHierarchyDCmd::num_arguments() { |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
896 |
ResourceMark rm; |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
897 |
ClassHierarchyDCmd* dcmd = new ClassHierarchyDCmd(NULL, false); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
898 |
if (dcmd != NULL) { |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
899 |
DCmdMark mark(dcmd); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
900 |
return dcmd->_dcmdparser.num_arguments(); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
901 |
} else { |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
902 |
return 0; |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
903 |
} |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
904 |
} |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
905 |
|
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
906 |
#endif |
31790 | 907 |
|
908 |
class VM_DumpTouchedMethods : public VM_Operation { |
|
909 |
private: |
|
910 |
outputStream* _out; |
|
911 |
public: |
|
912 |
VM_DumpTouchedMethods(outputStream* out) { |
|
913 |
_out = out; |
|
914 |
} |
|
915 |
||
916 |
virtual VMOp_Type type() const { return VMOp_DumpTouchedMethods; } |
|
917 |
||
918 |
virtual void doit() { |
|
919 |
Method::print_touched_methods(_out); |
|
920 |
} |
|
921 |
}; |
|
922 |
||
923 |
TouchedMethodsDCmd::TouchedMethodsDCmd(outputStream* output, bool heap) : |
|
924 |
DCmdWithParser(output, heap) |
|
925 |
{} |
|
926 |
||
927 |
void TouchedMethodsDCmd::execute(DCmdSource source, TRAPS) { |
|
928 |
if (!UnlockDiagnosticVMOptions) { |
|
929 |
output()->print_cr("VM.touched_methods command requires -XX:+UnlockDiagnosticVMOptions"); |
|
930 |
return; |
|
931 |
} |
|
932 |
VM_DumpTouchedMethods dumper(output()); |
|
933 |
VMThread::execute(&dumper); |
|
934 |
} |
|
935 |
||
936 |
int TouchedMethodsDCmd::num_arguments() { |
|
937 |
return 0; |
|
938 |
} |