author | clanger |
Wed, 12 Dec 2018 11:34:08 +0000 | |
changeset 52976 | 21dfea980e23 |
parent 52876 | 2d17750d41e7 |
child 54786 | ebf733a324d4 |
child 57221 | 9653470b7294 |
permissions | -rw-r--r-- |
11209 | 1 |
/* |
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
47765
diff
changeset
|
2 |
* Copyright (c) 2011, 2018, 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" |
|
47765
b7c7428eaab9
8189610: Reconcile jvm.h and all jvm_md.h between java.base and hotspot
coleenp
parents:
47216
diff
changeset
|
26 |
#include "jvm.h" |
50443
8e56de95ce10
8203682: Add jcmd "VM.classloaders" command to print out class loader hierarchy, details
stuefe
parents:
49980
diff
changeset
|
27 |
#include "classfile/classLoaderHierarchyDCmd.hpp" |
25051
8110ec6e7340
8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
24424
diff
changeset
|
28 |
#include "classfile/classLoaderStats.hpp" |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
29 |
#include "compiler/compileBroker.hpp" |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
30 |
#include "compiler/directivesParser.hpp" |
52876
2d17750d41e7
8214791: Consistently name gc files containing VM operations
tschatzl
parents:
52148
diff
changeset
|
31 |
#include "gc/shared/gcVMOperations.hpp" |
49980 | 32 |
#include "memory/metaspace/metaspaceDCmd.hpp" |
37248 | 33 |
#include "memory/resourceArea.hpp" |
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49053
diff
changeset
|
34 |
#include "oops/objArrayOop.inline.hpp" |
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28935
diff
changeset
|
35 |
#include "oops/oop.inline.hpp" |
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
47765
diff
changeset
|
36 |
#include "oops/typeArrayOop.inline.hpp" |
51467
12997ebbc0d8
8209647: constantPoolHandle::constantPoolHandle(ConstantPool*) when precompiled header is disabled
iklam
parents:
51334
diff
changeset
|
37 |
#include "runtime/fieldDescriptor.inline.hpp" |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
38 |
#include "runtime/flags/jvmFlag.hpp" |
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49053
diff
changeset
|
39 |
#include "runtime/handles.inline.hpp" |
52976 | 40 |
#include "runtime/interfaceSupport.inline.hpp" |
11441 | 41 |
#include "runtime/javaCalls.hpp" |
22490
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
42 |
#include "runtime/os.hpp" |
11209 | 43 |
#include "services/diagnosticArgument.hpp" |
44 |
#include "services/diagnosticCommand.hpp" |
|
45 |
#include "services/diagnosticFramework.hpp" |
|
11441 | 46 |
#include "services/heapDumper.hpp" |
47 |
#include "services/management.hpp" |
|
30764 | 48 |
#include "services/writeableFlags.hpp" |
46560
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46458
diff
changeset
|
49 |
#include "utilities/debug.hpp" |
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
46458
diff
changeset
|
50 |
#include "utilities/formatBuffer.hpp" |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13977
diff
changeset
|
51 |
#include "utilities/macros.hpp" |
11209 | 52 |
|
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
53 |
|
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
54 |
static void loadAgentModule(TRAPS) { |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
55 |
ResourceMark rm(THREAD); |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
56 |
HandleMark hm(THREAD); |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
57 |
|
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
58 |
JavaValue result(T_OBJECT); |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
59 |
Handle h_module_name = java_lang_String::create_from_str("jdk.management.agent", CHECK); |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
60 |
JavaCalls::call_static(&result, |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
61 |
SystemDictionary::module_Modules_klass(), |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
62 |
vmSymbols::loadModule_name(), |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
63 |
vmSymbols::loadModule_signature(), |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
64 |
h_module_name, |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
65 |
THREAD); |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
66 |
} |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
67 |
|
11598
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
68 |
void DCmdRegistrant::register_dcmds(){ |
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
69 |
// Registration of the diagnostic commands |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
70 |
// 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
|
71 |
// 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
|
72 |
// 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
|
73 |
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
|
74 |
| DCmd_Source_MBean; |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
75 |
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
|
76 |
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
|
77 |
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
|
78 |
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
|
79 |
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
|
80 |
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
|
81 |
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
|
82 |
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
|
83 |
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
|
84 |
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
|
85 |
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
|
86 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapInfoDCmd>(full_export, true, false)); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
87 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<FinalizerInfoDCmd>(full_export, true, false)); |
37195
88b6f1271f64
8151991: jvmti diagnostics commands requires INCLUDE_SERVICES
dsamersoff
parents:
36597
diff
changeset
|
88 |
#if INCLUDE_SERVICES |
20662
3296bf2cc204
8020789: Disable exporting of gc.heap_dump diagnostic command
sgabdura
parents:
18025
diff
changeset
|
89 |
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
|
90 |
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
|
91 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassStatsDCmd>(full_export, true, false)); |
46742 | 92 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDictionaryDCmd>(full_export, true, false)); |
29071
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
93 |
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
|
94 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false)); |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
26587
diff
changeset
|
95 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false)); |
49980 | 96 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<metaspace::MetaspaceDCmd>(full_export, true, false)); |
37195
88b6f1271f64
8151991: jvmti diagnostics commands requires INCLUDE_SERVICES
dsamersoff
parents:
36597
diff
changeset
|
97 |
#if INCLUDE_JVMTI // Both JVMTI and SERVICES have to be enabled to have this dcmd |
88b6f1271f64
8151991: jvmti diagnostics commands requires INCLUDE_SERVICES
dsamersoff
parents:
36597
diff
changeset
|
98 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIAgentLoadDCmd>(full_export, true, false)); |
88b6f1271f64
8151991: jvmti diagnostics commands requires INCLUDE_SERVICES
dsamersoff
parents:
36597
diff
changeset
|
99 |
#endif // INCLUDE_JVMTI |
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
100 |
#endif // INCLUDE_SERVICES |
30121
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
101 |
#if INCLUDE_JVMTI |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
102 |
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
|
103 |
#endif // INCLUDE_JVMTI |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
104 |
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
|
105 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false)); |
50443
8e56de95ce10
8203682: Add jcmd "VM.classloaders" command to print out class loader hierarchy, details
stuefe
parents:
49980
diff
changeset
|
106 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderHierarchyDCmd>(full_export, true, false)); |
26587 | 107 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false)); |
108 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false)); |
|
109 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false)); |
|
31790 | 110 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TouchedMethodsDCmd>(full_export, true, false)); |
49611 | 111 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeHeapAnalyticsDCmd>(full_export, true, false)); |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
112 |
|
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
113 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesPrintDCmd>(full_export, true, false)); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
114 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesAddDCmd>(full_export, true, false)); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
115 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesRemoveDCmd>(full_export, true, false)); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
116 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesClearDCmd>(full_export, true, false)); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
117 |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
118 |
// Enhanced JMX Agent Support |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
119 |
// 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
|
120 |
// appropriate permission is created for them |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
121 |
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
|
122 |
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
|
123 |
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
|
124 |
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
|
125 |
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
|
126 |
|
52976 | 127 |
// Debug on cmd (only makes sense with JVMTI since the agentlib needs it). |
128 |
#if INCLUDE_JVMTI |
|
129 |
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DebugOnCmdStartDCmd>(full_export, true, false)); |
|
130 |
#endif // INCLUDE_JVMTI |
|
131 |
||
11598
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
132 |
} |
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
133 |
|
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
134 |
#ifndef HAVE_EXTRA_DCMD |
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
135 |
void DCmdRegistrant::register_dcmds_ext(){ |
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
136 |
// Do nothing here |
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
137 |
} |
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
138 |
#endif |
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
139 |
|
db8931f2a56d
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
11441
diff
changeset
|
140 |
|
11441 | 141 |
HelpDCmd::HelpDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap), |
11209 | 142 |
_all("-all", "Show help for all commands", "BOOLEAN", false, "false"), |
143 |
_cmd("command name", "The name of the command for which we want help", |
|
144 |
"STRING", false) { |
|
145 |
_dcmdparser.add_dcmd_option(&_all); |
|
146 |
_dcmdparser.add_dcmd_argument(&_cmd); |
|
147 |
}; |
|
148 |
||
49750 | 149 |
|
150 |
static int compare_strings(const char** s1, const char** s2) { |
|
151 |
return ::strcmp(*s1, *s2); |
|
152 |
} |
|
153 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
154 |
void HelpDCmd::execute(DCmdSource source, TRAPS) { |
11209 | 155 |
if (_all.value()) { |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
156 |
GrowableArray<const char*>* cmd_list = DCmdFactory::DCmd_list(source); |
49750 | 157 |
cmd_list->sort(compare_strings); |
11209 | 158 |
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
|
159 |
DCmdFactory* factory = DCmdFactory::factory(source, cmd_list->at(i), |
11209 | 160 |
strlen(cmd_list->at(i))); |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
161 |
output()->print_cr("%s%s", factory->name(), |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
162 |
factory->is_enabled() ? "" : " [disabled]"); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
163 |
output()->print_cr("\t%s", factory->description()); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
164 |
output()->cr(); |
11209 | 165 |
factory = factory->next(); |
166 |
} |
|
167 |
} else if (_cmd.has_value()) { |
|
168 |
DCmd* cmd = NULL; |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
169 |
DCmdFactory* factory = DCmdFactory::factory(source, _cmd.value(), |
11209 | 170 |
strlen(_cmd.value())); |
171 |
if (factory != NULL) { |
|
172 |
output()->print_cr("%s%s", factory->name(), |
|
173 |
factory->is_enabled() ? "" : " [disabled]"); |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23517
diff
changeset
|
174 |
output()->print_cr("%s", factory->description()); |
11209 | 175 |
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
|
176 |
JavaPermission p = factory->permission(); |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
177 |
if(p._class != NULL) { |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
178 |
if(p._action != NULL) { |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
179 |
output()->print_cr("\nPermission: %s(%s, %s)", |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
180 |
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
|
181 |
} else { |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
182 |
output()->print_cr("\nPermission: %s(%s)", |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
183 |
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
|
184 |
} |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
185 |
} |
11441 | 186 |
output()->cr(); |
11209 | 187 |
cmd = factory->create_resource_instance(output()); |
188 |
if (cmd != NULL) { |
|
189 |
DCmdMark mark(cmd); |
|
11441 | 190 |
cmd->print_help(factory->name()); |
11209 | 191 |
} |
192 |
} else { |
|
193 |
output()->print_cr("Help unavailable : '%s' : No such command", _cmd.value()); |
|
194 |
} |
|
195 |
} else { |
|
196 |
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
|
197 |
GrowableArray<const char *>* cmd_list = DCmdFactory::DCmd_list(source); |
49750 | 198 |
cmd_list->sort(compare_strings); |
11209 | 199 |
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
|
200 |
DCmdFactory* factory = DCmdFactory::factory(source, cmd_list->at(i), |
11209 | 201 |
strlen(cmd_list->at(i))); |
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
202 |
output()->print_cr("%s%s", factory->name(), |
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
203 |
factory->is_enabled() ? "" : " [disabled]"); |
11209 | 204 |
factory = factory->_next; |
205 |
} |
|
206 |
output()->print_cr("\nFor more information about a specific command use 'help <command>'."); |
|
207 |
} |
|
208 |
} |
|
209 |
||
210 |
int HelpDCmd::num_arguments() { |
|
211 |
ResourceMark rm; |
|
212 |
HelpDCmd* dcmd = new HelpDCmd(NULL, false); |
|
213 |
if (dcmd != NULL) { |
|
214 |
DCmdMark mark(dcmd); |
|
215 |
return dcmd->_dcmdparser.num_arguments(); |
|
216 |
} else { |
|
217 |
return 0; |
|
218 |
} |
|
219 |
} |
|
220 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
221 |
void VersionDCmd::execute(DCmdSource source, TRAPS) { |
52148
2d9f8845d0ae
7041262: VM_Version should be called instead of Abstract_VM_Version so that overriding works
hseigel
parents:
51823
diff
changeset
|
222 |
output()->print_cr("%s version %s", VM_Version::vm_name(), |
2d9f8845d0ae
7041262: VM_Version should be called instead of Abstract_VM_Version so that overriding works
hseigel
parents:
51823
diff
changeset
|
223 |
VM_Version::vm_release()); |
11209 | 224 |
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
|
225 |
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
|
226 |
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
|
227 |
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
|
228 |
jdk_version.patch_version()); |
11209 | 229 |
} else { |
33959
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
30764
diff
changeset
|
230 |
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
|
231 |
jdk_version.minor_version(), jdk_version.security_version()); |
11209 | 232 |
} |
233 |
} |
|
11441 | 234 |
|
235 |
PrintVMFlagsDCmd::PrintVMFlagsDCmd(outputStream* output, bool heap) : |
|
236 |
DCmdWithParser(output, heap), |
|
237 |
_all("-all", "Print all flags supported by the VM", "BOOLEAN", false, "false") { |
|
238 |
_dcmdparser.add_dcmd_option(&_all); |
|
239 |
} |
|
240 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
241 |
void PrintVMFlagsDCmd::execute(DCmdSource source, TRAPS) { |
11441 | 242 |
if (_all.value()) { |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
243 |
JVMFlag::printFlags(output(), true); |
11441 | 244 |
} else { |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
245 |
JVMFlag::printSetFlags(output()); |
11441 | 246 |
} |
247 |
} |
|
248 |
||
249 |
int PrintVMFlagsDCmd::num_arguments() { |
|
250 |
ResourceMark rm; |
|
251 |
PrintVMFlagsDCmd* dcmd = new PrintVMFlagsDCmd(NULL, false); |
|
252 |
if (dcmd != NULL) { |
|
253 |
DCmdMark mark(dcmd); |
|
254 |
return dcmd->_dcmdparser.num_arguments(); |
|
255 |
} else { |
|
256 |
return 0; |
|
257 |
} |
|
258 |
} |
|
259 |
||
30121
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
260 |
SetVMFlagDCmd::SetVMFlagDCmd(outputStream* output, bool heap) : |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
261 |
DCmdWithParser(output, heap), |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
262 |
_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
|
263 |
"STRING", true), |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
264 |
_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
|
265 |
_dcmdparser.add_dcmd_argument(&_flag); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
266 |
_dcmdparser.add_dcmd_argument(&_value); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
267 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
268 |
|
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
269 |
void SetVMFlagDCmd::execute(DCmdSource source, TRAPS) { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
270 |
const char* val = NULL; |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
271 |
if (_value.value() != NULL) { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
272 |
val = _value.value(); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
273 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
274 |
|
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
275 |
FormatBuffer<80> err_msg("%s", ""); |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
276 |
int ret = WriteableFlags::set_flag(_flag.value(), val, JVMFlag::MANAGEMENT, err_msg); |
30121
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
277 |
|
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
278 |
if (ret != JVMFlag::SUCCESS) { |
30121
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
279 |
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
|
280 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
281 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
282 |
|
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
283 |
int SetVMFlagDCmd::num_arguments() { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
284 |
ResourceMark rm; |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
285 |
SetVMFlagDCmd* dcmd = new SetVMFlagDCmd(NULL, false); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
286 |
if (dcmd != NULL) { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
287 |
DCmdMark mark(dcmd); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
288 |
return dcmd->_dcmdparser.num_arguments(); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
289 |
} else { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
290 |
return 0; |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
291 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
292 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
293 |
|
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
294 |
void JVMTIDataDumpDCmd::execute(DCmdSource source, TRAPS) { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
295 |
if (JvmtiExport::should_post_data_dump()) { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
296 |
JvmtiExport::post_data_dump(); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
297 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
298 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
29085
diff
changeset
|
299 |
|
37195
88b6f1271f64
8151991: jvmti diagnostics commands requires INCLUDE_SERVICES
dsamersoff
parents:
36597
diff
changeset
|
300 |
#if INCLUDE_SERVICES |
36188
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
301 |
JVMTIAgentLoadDCmd::JVMTIAgentLoadDCmd(outputStream* output, bool heap) : |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
302 |
DCmdWithParser(output, heap), |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
303 |
_libpath("library path", "Absolute path of the JVMTI agent to load.", |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
304 |
"STRING", true), |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
305 |
_option("agent option", "Option string to pass the agent.", "STRING", false) { |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
306 |
_dcmdparser.add_dcmd_argument(&_libpath); |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
307 |
_dcmdparser.add_dcmd_argument(&_option); |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
308 |
} |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
309 |
|
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
310 |
void JVMTIAgentLoadDCmd::execute(DCmdSource source, TRAPS) { |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
311 |
|
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
312 |
if (_libpath.value() == NULL) { |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
313 |
output()->print_cr("JVMTI.agent_load dcmd needs library path."); |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
314 |
return; |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
315 |
} |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
316 |
|
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
317 |
char *suffix = strrchr(_libpath.value(), '.'); |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
318 |
bool is_java_agent = (suffix != NULL) && (strncmp(".jar", suffix, 4) == 0); |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
319 |
|
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
320 |
if (is_java_agent) { |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
321 |
if (_option.value() == NULL) { |
41078 | 322 |
JvmtiExport::load_agent_library("instrument", "false", |
323 |
_libpath.value(), output()); |
|
36188
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
324 |
} else { |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
325 |
size_t opt_len = strlen(_libpath.value()) + strlen(_option.value()) + 2; |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
326 |
if (opt_len > 4096) { |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
327 |
output()->print_cr("JVMTI agent attach failed: Options is too long."); |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
328 |
return; |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
329 |
} |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
330 |
|
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
331 |
char *opt = (char *)os::malloc(opt_len, mtInternal); |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
332 |
if (opt == NULL) { |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
333 |
output()->print_cr("JVMTI agent attach failed: " |
43407 | 334 |
"Could not allocate " SIZE_FORMAT " bytes for argument.", |
36188
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
335 |
opt_len); |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
336 |
return; |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
337 |
} |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
338 |
|
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
339 |
jio_snprintf(opt, opt_len, "%s=%s", _libpath.value(), _option.value()); |
41078 | 340 |
JvmtiExport::load_agent_library("instrument", "false", opt, output()); |
36188
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
341 |
|
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
342 |
os::free(opt); |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
343 |
} |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
344 |
} else { |
41078 | 345 |
JvmtiExport::load_agent_library(_libpath.value(), "true", |
346 |
_option.value(), output()); |
|
36188
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
347 |
} |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
348 |
} |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
349 |
|
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
350 |
int JVMTIAgentLoadDCmd::num_arguments() { |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
351 |
ResourceMark rm; |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
352 |
JVMTIAgentLoadDCmd* dcmd = new JVMTIAgentLoadDCmd(NULL, false); |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
353 |
if (dcmd != NULL) { |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
354 |
DCmdMark mark(dcmd); |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
355 |
return dcmd->_dcmdparser.num_arguments(); |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
356 |
} else { |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
357 |
return 0; |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
358 |
} |
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
359 |
} |
37195
88b6f1271f64
8151991: jvmti diagnostics commands requires INCLUDE_SERVICES
dsamersoff
parents:
36597
diff
changeset
|
360 |
#endif // INCLUDE_SERVICES |
36188
99b6836dd3e8
8147388: Add diagnostic commands to attach JVMTI agent.
ysuenaga
parents:
35825
diff
changeset
|
361 |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
362 |
void PrintSystemPropertiesDCmd::execute(DCmdSource source, TRAPS) { |
36795
bfd8c074c8ec
8153181: Move sun.misc.VMSupport to an internal package
chegar
parents:
36597
diff
changeset
|
363 |
// load VMSupport |
bfd8c074c8ec
8153181: Move sun.misc.VMSupport to an internal package
chegar
parents:
36597
diff
changeset
|
364 |
Symbol* klass = vmSymbols::jdk_internal_vm_VMSupport(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11953
diff
changeset
|
365 |
Klass* k = SystemDictionary::resolve_or_fail(klass, true, CHECK); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46311
diff
changeset
|
366 |
InstanceKlass* ik = InstanceKlass::cast(k); |
11441 | 367 |
if (ik->should_be_initialized()) { |
368 |
ik->initialize(THREAD); |
|
369 |
} |
|
370 |
if (HAS_PENDING_EXCEPTION) { |
|
371 |
java_lang_Throwable::print(PENDING_EXCEPTION, output()); |
|
372 |
output()->cr(); |
|
373 |
CLEAR_PENDING_EXCEPTION; |
|
374 |
return; |
|
375 |
} |
|
376 |
||
377 |
// invoke the serializePropertiesToByteArray method |
|
378 |
JavaValue result(T_OBJECT); |
|
379 |
JavaCallArguments args; |
|
380 |
||
381 |
Symbol* signature = vmSymbols::serializePropertiesToByteArray_signature(); |
|
382 |
JavaCalls::call_static(&result, |
|
383 |
ik, |
|
384 |
vmSymbols::serializePropertiesToByteArray_name(), |
|
385 |
signature, |
|
386 |
&args, |
|
387 |
THREAD); |
|
388 |
if (HAS_PENDING_EXCEPTION) { |
|
389 |
java_lang_Throwable::print(PENDING_EXCEPTION, output()); |
|
390 |
output()->cr(); |
|
391 |
CLEAR_PENDING_EXCEPTION; |
|
392 |
return; |
|
393 |
} |
|
394 |
||
395 |
// The result should be a [B |
|
396 |
oop res = (oop)result.get_jobject(); |
|
397 |
assert(res->is_typeArray(), "just checking"); |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
398 |
assert(TypeArrayKlass::cast(res->klass())->element_type() == T_BYTE, "just checking"); |
11441 | 399 |
|
400 |
// copy the bytes to the output stream |
|
401 |
typeArrayOop ba = typeArrayOop(res); |
|
402 |
jbyte* addr = typeArrayOop(res)->byte_at_addr(0); |
|
403 |
output()->print_raw((const char*)addr, ba->length()); |
|
404 |
} |
|
405 |
||
406 |
VMUptimeDCmd::VMUptimeDCmd(outputStream* output, bool heap) : |
|
407 |
DCmdWithParser(output, heap), |
|
408 |
_date("-date", "Add a prefix with current date", "BOOLEAN", false, "false") { |
|
409 |
_dcmdparser.add_dcmd_option(&_date); |
|
410 |
} |
|
411 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
412 |
void VMUptimeDCmd::execute(DCmdSource source, TRAPS) { |
11441 | 413 |
if (_date.value()) { |
414 |
output()->date_stamp(true, "", ": "); |
|
415 |
} |
|
416 |
output()->time_stamp().update_to(tty->time_stamp().ticks()); |
|
417 |
output()->stamp(); |
|
418 |
output()->print_cr(" s"); |
|
419 |
} |
|
420 |
||
421 |
int VMUptimeDCmd::num_arguments() { |
|
422 |
ResourceMark rm; |
|
423 |
VMUptimeDCmd* dcmd = new VMUptimeDCmd(NULL, false); |
|
424 |
if (dcmd != NULL) { |
|
425 |
DCmdMark mark(dcmd); |
|
426 |
return dcmd->_dcmdparser.num_arguments(); |
|
427 |
} else { |
|
428 |
return 0; |
|
429 |
} |
|
430 |
} |
|
431 |
||
34139
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33451
diff
changeset
|
432 |
void VMInfoDCmd::execute(DCmdSource source, TRAPS) { |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33451
diff
changeset
|
433 |
VMError::print_vm_info(_output); |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33451
diff
changeset
|
434 |
} |
0728fe06ccf8
8027429: Add diagnostic command VM.info to get hs_err print-out
coleenp
parents:
33451
diff
changeset
|
435 |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
436 |
void SystemGCDCmd::execute(DCmdSource source, TRAPS) { |
47105
d8bd7f7d5147
8186902: jcmd GC.run should not be blocked by DisableExplicitGC
kevinw
parents:
46742
diff
changeset
|
437 |
Universe::heap()->collect(GCCause::_dcmd_gc_run); |
11441 | 438 |
} |
439 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
440 |
void RunFinalizationDCmd::execute(DCmdSource source, TRAPS) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11953
diff
changeset
|
441 |
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), |
11441 | 442 |
true, CHECK); |
443 |
JavaValue result(T_VOID); |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46311
diff
changeset
|
444 |
JavaCalls::call_static(&result, k, |
11441 | 445 |
vmSymbols::run_finalization_name(), |
446 |
vmSymbols::void_method_signature(), CHECK); |
|
447 |
} |
|
448 |
||
32072
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
449 |
void HeapInfoDCmd::execute(DCmdSource source, TRAPS) { |
39401 | 450 |
MutexLocker hl(Heap_lock); |
32072
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
451 |
Universe::heap()->print_on(output()); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
452 |
} |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
453 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
454 |
void FinalizerInfoDCmd::execute(DCmdSource source, TRAPS) { |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
455 |
ResourceMark rm; |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
456 |
|
46311
7545c36a5e76
8175341: "java/util/Arrays/ParallelPrefix.java" Crash Internal Error ...diagnosticCommand.cpp...assert(k != __null) failed: FinalizerHistogram class is not accessible
cjplummer
parents:
43491
diff
changeset
|
457 |
Klass* k = SystemDictionary::resolve_or_fail( |
7545c36a5e76
8175341: "java/util/Arrays/ParallelPrefix.java" Crash Internal Error ...diagnosticCommand.cpp...assert(k != __null) failed: FinalizerHistogram class is not accessible
cjplummer
parents:
43491
diff
changeset
|
458 |
vmSymbols::finalizer_histogram_klass(), true, CHECK); |
32072
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
459 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
460 |
JavaValue result(T_ARRAY); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
461 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
462 |
// We are calling lang.ref.FinalizerHistogram.getFinalizerHistogram() method |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
463 |
// and expect it to return array of FinalizerHistogramEntry as Object[] |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
464 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46311
diff
changeset
|
465 |
JavaCalls::call_static(&result, k, |
32072
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
466 |
vmSymbols::get_finalizer_histogram_name(), |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
467 |
vmSymbols::void_finalizer_histogram_entry_array_signature(), CHECK); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
468 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
469 |
objArrayOop result_oop = (objArrayOop) result.get_jobject(); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
470 |
if (result_oop->length() == 0) { |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
471 |
output()->print_cr("No instances waiting for finalization found"); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
472 |
return; |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
473 |
} |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
474 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
475 |
oop foop = result_oop->obj_at(0); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
476 |
InstanceKlass* ik = InstanceKlass::cast(foop->klass()); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
477 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
478 |
fieldDescriptor count_fd, name_fd; |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
479 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
480 |
Klass* count_res = ik->find_field( |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
481 |
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
|
482 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
483 |
Klass* name_res = ik->find_field( |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
484 |
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
|
485 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
486 |
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
|
487 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
488 |
output()->print_cr("Unreachable instances waiting for finalization"); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
489 |
output()->print_cr("#instances class name"); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
490 |
output()->print_cr("-----------------------"); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
491 |
|
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
492 |
for (int i = 0; i < result_oop->length(); ++i) { |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
493 |
oop element_oop = result_oop->obj_at(i); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
494 |
oop str_oop = element_oop->obj_field(name_fd.offset()); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
495 |
char *name = java_lang_String::as_utf8_string(str_oop); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
496 |
int count = element_oop->int_field(count_fd.offset()); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
497 |
output()->print_cr("%10d %s", count, name); |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
498 |
} |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
499 |
} |
bc13add2c295
8059036: Implement Diagnostic Commands for heap and finalizerinfo
dsamersoff
parents:
31790
diff
changeset
|
500 |
|
15437 | 501 |
#if INCLUDE_SERVICES // Heap dumping/inspection supported |
11441 | 502 |
HeapDumpDCmd::HeapDumpDCmd(outputStream* output, bool heap) : |
503 |
DCmdWithParser(output, heap), |
|
504 |
_filename("filename","Name of the dump file", "STRING",true), |
|
505 |
_all("-all", "Dump all objects, including unreachable objects", |
|
506 |
"BOOLEAN", false, "false") { |
|
507 |
_dcmdparser.add_dcmd_option(&_all); |
|
508 |
_dcmdparser.add_dcmd_argument(&_filename); |
|
509 |
} |
|
510 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
511 |
void HeapDumpDCmd::execute(DCmdSource source, TRAPS) { |
11441 | 512 |
// Request a full GC before heap dump if _all is false |
513 |
// This helps reduces the amount of unreachable objects in the dump |
|
514 |
// and makes it easier to browse. |
|
515 |
HeapDumper dumper(!_all.value() /* request GC if _all is false*/); |
|
516 |
int res = dumper.dump(_filename.value()); |
|
517 |
if (res == 0) { |
|
518 |
output()->print_cr("Heap dump file created"); |
|
519 |
} else { |
|
520 |
// heap dump failed |
|
521 |
ResourceMark rm; |
|
522 |
char* error = dumper.error_as_C_string(); |
|
523 |
if (error == NULL) { |
|
524 |
output()->print_cr("Dump failed - reason unknown"); |
|
525 |
} else { |
|
526 |
output()->print_cr("%s", error); |
|
527 |
} |
|
528 |
} |
|
529 |
} |
|
530 |
||
531 |
int HeapDumpDCmd::num_arguments() { |
|
532 |
ResourceMark rm; |
|
533 |
HeapDumpDCmd* dcmd = new HeapDumpDCmd(NULL, false); |
|
534 |
if (dcmd != NULL) { |
|
535 |
DCmdMark mark(dcmd); |
|
536 |
return dcmd->_dcmdparser.num_arguments(); |
|
537 |
} else { |
|
538 |
return 0; |
|
539 |
} |
|
540 |
} |
|
541 |
||
542 |
ClassHistogramDCmd::ClassHistogramDCmd(outputStream* output, bool heap) : |
|
543 |
DCmdWithParser(output, heap), |
|
544 |
_all("-all", "Inspect all objects, including unreachable objects", |
|
545 |
"BOOLEAN", false, "false") { |
|
546 |
_dcmdparser.add_dcmd_option(&_all); |
|
547 |
} |
|
548 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
549 |
void ClassHistogramDCmd::execute(DCmdSource source, TRAPS) { |
11441 | 550 |
VM_GC_HeapInspection heapop(output(), |
18025 | 551 |
!_all.value() /* request full gc if false */); |
11441 | 552 |
VMThread::execute(&heapop); |
553 |
} |
|
554 |
||
555 |
int ClassHistogramDCmd::num_arguments() { |
|
556 |
ResourceMark rm; |
|
557 |
ClassHistogramDCmd* dcmd = new ClassHistogramDCmd(NULL, false); |
|
558 |
if (dcmd != NULL) { |
|
559 |
DCmdMark mark(dcmd); |
|
560 |
return dcmd->_dcmdparser.num_arguments(); |
|
561 |
} else { |
|
562 |
return 0; |
|
563 |
} |
|
564 |
} |
|
565 |
||
15437 | 566 |
#define DEFAULT_COLUMNS "InstBytes,KlassBytes,CpAll,annotations,MethodCount,Bytecodes,MethodAll,ROAll,RWAll,Total" |
567 |
ClassStatsDCmd::ClassStatsDCmd(outputStream* output, bool heap) : |
|
568 |
DCmdWithParser(output, heap), |
|
51334
cc2c79d22508
8208671: Runtime, JFR, Serviceability changes to allow enabling -Wreorder
tschatzl
parents:
50785
diff
changeset
|
569 |
_all("-all", "Show all columns", |
15437 | 570 |
"BOOLEAN", false, "false"), |
51334
cc2c79d22508
8208671: Runtime, JFR, Serviceability changes to allow enabling -Wreorder
tschatzl
parents:
50785
diff
changeset
|
571 |
_csv("-csv", "Print in CSV (comma-separated values) format for spreadsheets", |
15437 | 572 |
"BOOLEAN", false, "false"), |
573 |
_help("-help", "Show meaning of all the columns", |
|
574 |
"BOOLEAN", false, "false"), |
|
575 |
_columns("columns", "Comma-separated list of all the columns to show. " |
|
576 |
"If not specified, the following columns are shown: " DEFAULT_COLUMNS, |
|
577 |
"STRING", false) { |
|
578 |
_dcmdparser.add_dcmd_option(&_all); |
|
579 |
_dcmdparser.add_dcmd_option(&_csv); |
|
580 |
_dcmdparser.add_dcmd_option(&_help); |
|
581 |
_dcmdparser.add_dcmd_argument(&_columns); |
|
582 |
} |
|
583 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
584 |
void ClassStatsDCmd::execute(DCmdSource source, TRAPS) { |
15437 | 585 |
VM_GC_HeapInspection heapop(output(), |
18025 | 586 |
true /* request_full_gc */); |
15437 | 587 |
heapop.set_csv_format(_csv.value()); |
588 |
heapop.set_print_help(_help.value()); |
|
589 |
heapop.set_print_class_stats(true); |
|
590 |
if (_all.value()) { |
|
591 |
if (_columns.has_value()) { |
|
592 |
output()->print_cr("Cannot specify -all and individual columns at the same time"); |
|
593 |
return; |
|
594 |
} else { |
|
595 |
heapop.set_columns(NULL); |
|
596 |
} |
|
597 |
} else { |
|
598 |
if (_columns.has_value()) { |
|
599 |
heapop.set_columns(_columns.value()); |
|
600 |
} else { |
|
601 |
heapop.set_columns(DEFAULT_COLUMNS); |
|
602 |
} |
|
603 |
} |
|
604 |
VMThread::execute(&heapop); |
|
605 |
} |
|
606 |
||
607 |
int ClassStatsDCmd::num_arguments() { |
|
608 |
ResourceMark rm; |
|
609 |
ClassStatsDCmd* dcmd = new ClassStatsDCmd(NULL, false); |
|
610 |
if (dcmd != NULL) { |
|
611 |
DCmdMark mark(dcmd); |
|
612 |
return dcmd->_dcmdparser.num_arguments(); |
|
613 |
} else { |
|
614 |
return 0; |
|
615 |
} |
|
616 |
} |
|
617 |
#endif // INCLUDE_SERVICES |
|
618 |
||
11441 | 619 |
ThreadDumpDCmd::ThreadDumpDCmd(outputStream* output, bool heap) : |
620 |
DCmdWithParser(output, heap), |
|
50785
d1b24f2ceca5
8200720: Print additional information in thread dump (times, allocated bytes etc.)
ghaug
parents:
50443
diff
changeset
|
621 |
_locks("-l", "print java.util.concurrent locks", "BOOLEAN", false, "false"), |
d1b24f2ceca5
8200720: Print additional information in thread dump (times, allocated bytes etc.)
ghaug
parents:
50443
diff
changeset
|
622 |
_extended("-e", "print extended thread information", "BOOLEAN", false, "false") { |
11441 | 623 |
_dcmdparser.add_dcmd_option(&_locks); |
50785
d1b24f2ceca5
8200720: Print additional information in thread dump (times, allocated bytes etc.)
ghaug
parents:
50443
diff
changeset
|
624 |
_dcmdparser.add_dcmd_option(&_extended); |
11441 | 625 |
} |
626 |
||
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
627 |
void ThreadDumpDCmd::execute(DCmdSource source, TRAPS) { |
11441 | 628 |
// thread stacks |
50785
d1b24f2ceca5
8200720: Print additional information in thread dump (times, allocated bytes etc.)
ghaug
parents:
50443
diff
changeset
|
629 |
VM_PrintThreads op1(output(), _locks.value(), _extended.value()); |
11441 | 630 |
VMThread::execute(&op1); |
631 |
||
632 |
// JNI global handles |
|
633 |
VM_PrintJNI op2(output()); |
|
634 |
VMThread::execute(&op2); |
|
635 |
||
636 |
// Deadlock detection |
|
637 |
VM_FindDeadlocks op3(output()); |
|
638 |
VMThread::execute(&op3); |
|
639 |
} |
|
640 |
||
641 |
int ThreadDumpDCmd::num_arguments() { |
|
642 |
ResourceMark rm; |
|
643 |
ThreadDumpDCmd* dcmd = new ThreadDumpDCmd(NULL, false); |
|
644 |
if (dcmd != NULL) { |
|
645 |
DCmdMark mark(dcmd); |
|
646 |
return dcmd->_dcmdparser.num_arguments(); |
|
647 |
} else { |
|
648 |
return 0; |
|
649 |
} |
|
650 |
} |
|
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
651 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
652 |
// Enhanced JMX Agent support |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
653 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
654 |
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
|
655 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
656 |
DCmdWithParser(output, heap_allocated), |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
657 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
658 |
_config_file |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
659 |
("config.file", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
660 |
"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
|
661 |
|
35186
89076d5121c0
6425769: Allow specifying an address to bind JMX remote connector
sgehwolf
parents:
35061
diff
changeset
|
662 |
_jmxremote_host |
89076d5121c0
6425769: Allow specifying an address to bind JMX remote connector
sgehwolf
parents:
35061
diff
changeset
|
663 |
("jmxremote.host", |
89076d5121c0
6425769: Allow specifying an address to bind JMX remote connector
sgehwolf
parents:
35061
diff
changeset
|
664 |
"set com.sun.management.jmxremote.host", "STRING", false), |
89076d5121c0
6425769: Allow specifying an address to bind JMX remote connector
sgehwolf
parents:
35061
diff
changeset
|
665 |
|
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
666 |
_jmxremote_port |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
667 |
("jmxremote.port", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
668 |
"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
|
669 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
670 |
_jmxremote_rmi_port |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
671 |
("jmxremote.rmi.port", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
672 |
"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
|
673 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
674 |
_jmxremote_ssl |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
675 |
("jmxremote.ssl", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
676 |
"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
|
677 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
678 |
_jmxremote_registry_ssl |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
679 |
("jmxremote.registry.ssl", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
680 |
"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
|
681 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
682 |
_jmxremote_authenticate |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
683 |
("jmxremote.authenticate", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
684 |
"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
|
685 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
686 |
_jmxremote_password_file |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
687 |
("jmxremote.password.file", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
688 |
"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
|
689 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
690 |
_jmxremote_access_file |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
691 |
("jmxremote.access.file", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
692 |
"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
|
693 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
694 |
_jmxremote_login_config |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
695 |
("jmxremote.login.config", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
696 |
"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
|
697 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
698 |
_jmxremote_ssl_enabled_cipher_suites |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
699 |
("jmxremote.ssl.enabled.cipher.suites", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
700 |
"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
|
701 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
702 |
_jmxremote_ssl_enabled_protocols |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
703 |
("jmxremote.ssl.enabled.protocols", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
704 |
"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
|
705 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
706 |
_jmxremote_ssl_need_client_auth |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
707 |
("jmxremote.ssl.need.client.auth", |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
708 |
"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
|
709 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
710 |
_jmxremote_ssl_config_file |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
711 |
("jmxremote.ssl.config.file", |
15460
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
712 |
"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
|
713 |
|
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
714 |
// JDP Protocol support |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
715 |
_jmxremote_autodiscovery |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
716 |
("jmxremote.autodiscovery", |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
717 |
"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
|
718 |
|
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
719 |
_jdp_port |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
720 |
("jdp.port", |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
721 |
"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
|
722 |
|
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
723 |
_jdp_address |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
724 |
("jdp.address", |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
725 |
"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
|
726 |
|
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
727 |
_jdp_source_addr |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
728 |
("jdp.source_addr", |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
729 |
"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
|
730 |
|
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
731 |
_jdp_ttl |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
732 |
("jdp.ttl", |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
733 |
"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
|
734 |
|
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
735 |
_jdp_pause |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
736 |
("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
|
737 |
"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
|
738 |
|
7cea9d36a46e
8026930: In ManagementAgent.start it should be possible to set the jdp.name parameter (hotspot part)
dsamersoff
parents:
18025
diff
changeset
|
739 |
_jdp_name |
7cea9d36a46e
8026930: In ManagementAgent.start it should be possible to set the jdp.name parameter (hotspot part)
dsamersoff
parents:
18025
diff
changeset
|
740 |
("jdp.name", |
7cea9d36a46e
8026930: In ManagementAgent.start it should be possible to set the jdp.name parameter (hotspot part)
dsamersoff
parents:
18025
diff
changeset
|
741 |
"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
|
742 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
743 |
{ |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
744 |
_dcmdparser.add_dcmd_option(&_config_file); |
35186
89076d5121c0
6425769: Allow specifying an address to bind JMX remote connector
sgehwolf
parents:
35061
diff
changeset
|
745 |
_dcmdparser.add_dcmd_option(&_jmxremote_host); |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
746 |
_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
|
747 |
_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
|
748 |
_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
|
749 |
_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
|
750 |
_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
|
751 |
_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
|
752 |
_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
|
753 |
_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
|
754 |
_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
|
755 |
_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
|
756 |
_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
|
757 |
_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
|
758 |
_dcmdparser.add_dcmd_option(&_jmxremote_autodiscovery); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
759 |
_dcmdparser.add_dcmd_option(&_jdp_port); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
760 |
_dcmdparser.add_dcmd_option(&_jdp_address); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
761 |
_dcmdparser.add_dcmd_option(&_jdp_source_addr); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
762 |
_dcmdparser.add_dcmd_option(&_jdp_ttl); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
763 |
_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
|
764 |
_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
|
765 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
766 |
|
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 |
int JMXStartRemoteDCmd::num_arguments() { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
769 |
ResourceMark rm; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
770 |
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
|
771 |
if (dcmd != NULL) { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
772 |
DCmdMark mark(dcmd); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
773 |
return dcmd->_dcmdparser.num_arguments(); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
774 |
} else { |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
775 |
return 0; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
776 |
} |
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 |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
779 |
|
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
780 |
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
|
781 |
ResourceMark rm(THREAD); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
782 |
HandleMark hm(THREAD); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
783 |
|
43400
cc18486e399f
8173608: Separate JDK management agent from java.management module
mchung
parents:
42075
diff
changeset
|
784 |
// Load and initialize the jdk.internal.agent.Agent class |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
785 |
// 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
|
786 |
// the remote management server. |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
787 |
// 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
|
788 |
|
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
789 |
loadAgentModule(CHECK); |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
790 |
Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); |
43400
cc18486e399f
8173608: Separate JDK management agent from java.management module
mchung
parents:
42075
diff
changeset
|
791 |
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_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
|
792 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
793 |
JavaValue result(T_VOID); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
794 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
795 |
// 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
|
796 |
// 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
|
797 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
798 |
int len = 0; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
799 |
stringStream options; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
800 |
char comma[2] = {0,0}; |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
801 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
802 |
// 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
|
803 |
// 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
|
804 |
// 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
|
805 |
// 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
|
806 |
// file. |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
807 |
#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
|
808 |
do { \ |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
809 |
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
|
810 |
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
|
811 |
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
|
812 |
} else { \ |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
813 |
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
|
814 |
} \ |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
815 |
comma[0] = ','; \ |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
816 |
}\ |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
817 |
} while(0); |
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
32072
diff
changeset
|
818 |
|
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
819 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
820 |
PUT_OPTION(_config_file); |
35186
89076d5121c0
6425769: Allow specifying an address to bind JMX remote connector
sgehwolf
parents:
35061
diff
changeset
|
821 |
PUT_OPTION(_jmxremote_host); |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
822 |
PUT_OPTION(_jmxremote_port); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
823 |
PUT_OPTION(_jmxremote_rmi_port); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
824 |
PUT_OPTION(_jmxremote_ssl); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
825 |
PUT_OPTION(_jmxremote_registry_ssl); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
826 |
PUT_OPTION(_jmxremote_authenticate); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
827 |
PUT_OPTION(_jmxremote_password_file); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
828 |
PUT_OPTION(_jmxremote_access_file); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
829 |
PUT_OPTION(_jmxremote_login_config); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
830 |
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
|
831 |
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
|
832 |
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
|
833 |
PUT_OPTION(_jmxremote_ssl_config_file); |
15460
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
834 |
PUT_OPTION(_jmxremote_autodiscovery); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
835 |
PUT_OPTION(_jdp_port); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
836 |
PUT_OPTION(_jdp_address); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
837 |
PUT_OPTION(_jdp_source_addr); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
838 |
PUT_OPTION(_jdp_ttl); |
ac08a4bdd0f6
8002048: Protocol to discovery of manageable Java processes on a network
dsamersoff
parents:
15437
diff
changeset
|
839 |
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
|
840 |
PUT_OPTION(_jdp_name); |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
841 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
842 |
#undef PUT_OPTION |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
843 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
844 |
Handle str = java_lang_String::create_from_str(options.as_string(), CHECK); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46311
diff
changeset
|
845 |
JavaCalls::call_static(&result, k, vmSymbols::startRemoteAgent_name(), vmSymbols::string_void_signature(), str, CHECK); |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
846 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
847 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
848 |
JMXStartLocalDCmd::JMXStartLocalDCmd(outputStream *output, bool heap_allocated) : |
22490
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
849 |
DCmd(output, heap_allocated) { |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
850 |
// do nothing |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
851 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
852 |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
853 |
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
|
854 |
ResourceMark rm(THREAD); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
855 |
HandleMark hm(THREAD); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
856 |
|
43400
cc18486e399f
8173608: Separate JDK management agent from java.management module
mchung
parents:
42075
diff
changeset
|
857 |
// Load and initialize the jdk.internal.agent.Agent class |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
858 |
// 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
|
859 |
// the local management server |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
860 |
// 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
|
861 |
|
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
862 |
loadAgentModule(CHECK); |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
863 |
Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); |
43400
cc18486e399f
8173608: Separate JDK management agent from java.management module
mchung
parents:
42075
diff
changeset
|
864 |
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_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
|
865 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
866 |
JavaValue result(T_VOID); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46311
diff
changeset
|
867 |
JavaCalls::call_static(&result, k, vmSymbols::startLocalAgent_name(), vmSymbols::void_method_signature(), CHECK); |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
868 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
869 |
|
17296
68557efd8583
8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents:
15484
diff
changeset
|
870 |
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
|
871 |
ResourceMark rm(THREAD); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
872 |
HandleMark hm(THREAD); |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
873 |
|
43400
cc18486e399f
8173608: Separate JDK management agent from java.management module
mchung
parents:
42075
diff
changeset
|
874 |
// Load and initialize the jdk.internal.agent.Agent class |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
875 |
// 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
|
876 |
// management server |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
877 |
// 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
|
878 |
|
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
879 |
loadAgentModule(CHECK); |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
880 |
Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); |
43400
cc18486e399f
8173608: Separate JDK management agent from java.management module
mchung
parents:
42075
diff
changeset
|
881 |
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_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
|
882 |
|
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
883 |
JavaValue result(T_VOID); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46311
diff
changeset
|
884 |
JavaCalls::call_static(&result, k, vmSymbols::stopRemoteAgent_name(), vmSymbols::void_method_signature(), CHECK); |
11953
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
885 |
} |
d06edd28ba62
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
11598
diff
changeset
|
886 |
|
30134
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
887 |
JMXStatusDCmd::JMXStatusDCmd(outputStream *output, bool heap_allocated) : |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
888 |
DCmd(output, heap_allocated) { |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
889 |
// do nothing |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
890 |
} |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
891 |
|
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
892 |
void JMXStatusDCmd::execute(DCmdSource source, TRAPS) { |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
893 |
ResourceMark rm(THREAD); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
894 |
HandleMark hm(THREAD); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
895 |
|
43400
cc18486e399f
8173608: Separate JDK management agent from java.management module
mchung
parents:
42075
diff
changeset
|
896 |
// Load and initialize the jdk.internal.agent.Agent class |
30134
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
897 |
// invoke getManagementAgentStatus() method to generate the status info |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
898 |
// throw java.lang.NoSuchMethodError if method doesn't exist |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
899 |
|
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
43491
diff
changeset
|
900 |
loadAgentModule(CHECK); |
30134
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
901 |
Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); |
43400
cc18486e399f
8173608: Separate JDK management agent from java.management module
mchung
parents:
42075
diff
changeset
|
902 |
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK); |
30134
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
903 |
|
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
904 |
JavaValue result(T_OBJECT); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46311
diff
changeset
|
905 |
JavaCalls::call_static(&result, k, vmSymbols::getAgentStatus_name(), vmSymbols::void_string_signature(), CHECK); |
30134
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
906 |
|
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
907 |
jvalue* jv = (jvalue*) result.get_value_addr(); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
908 |
oop str = (oop) jv->l; |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
909 |
if (str != NULL) { |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
910 |
char* out = java_lang_String::as_utf8_string(str); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
911 |
if (out) { |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
912 |
output()->print_cr("%s", out); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
913 |
return; |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
914 |
} |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
915 |
} |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
916 |
output()->print_cr("Error obtaining management agent status"); |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
917 |
} |
ecd7b08105e9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
30121
diff
changeset
|
918 |
|
22490
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
919 |
VMDynamicLibrariesDCmd::VMDynamicLibrariesDCmd(outputStream *output, bool heap_allocated) : |
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
920 |
DCmd(output, heap_allocated) { |
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
921 |
// do nothing |
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
922 |
} |
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
923 |
|
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
924 |
void VMDynamicLibrariesDCmd::execute(DCmdSource source, TRAPS) { |
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
925 |
os::print_dll_info(output()); |
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
926 |
output()->cr(); |
039128291aa6
8031304: Add dcmd to print all loaded dynamic libraries.
farvidsson
parents:
21121
diff
changeset
|
927 |
} |
23517 | 928 |
|
26587 | 929 |
void CompileQueueDCmd::execute(DCmdSource source, TRAPS) { |
36322 | 930 |
VM_PrintCompileQueue printCompileQueueOp(output()); |
931 |
VMThread::execute(&printCompileQueueOp); |
|
26587 | 932 |
} |
933 |
||
934 |
void CodeListDCmd::execute(DCmdSource source, TRAPS) { |
|
35825
7c7652ee137b
8063112: Compiler diagnostic commands should have locking instead of safepoint
neliasso
parents:
35186
diff
changeset
|
935 |
CodeCache::print_codelist(output()); |
26587 | 936 |
} |
937 |
||
938 |
void CodeCacheDCmd::execute(DCmdSource source, TRAPS) { |
|
35825
7c7652ee137b
8063112: Compiler diagnostic commands should have locking instead of safepoint
neliasso
parents:
35186
diff
changeset
|
939 |
CodeCache::print_layout(output()); |
26587 | 940 |
} |
941 |
||
49611 | 942 |
//---< BEGIN >--- CodeHeap State Analytics. |
943 |
CodeHeapAnalyticsDCmd::CodeHeapAnalyticsDCmd(outputStream* output, bool heap) : |
|
944 |
DCmdWithParser(output, heap), |
|
49825 | 945 |
_function("function", "Function to be performed (aggregate, UsedSpace, FreeSpace, MethodCount, MethodSpace, MethodAge, MethodNames, discard", "STRING", false, "all"), |
49611 | 946 |
_granularity("granularity", "Detail level - smaller value -> more detail", "STRING", false, "4096") { |
947 |
_dcmdparser.add_dcmd_argument(&_function); |
|
948 |
_dcmdparser.add_dcmd_argument(&_granularity); |
|
949 |
} |
|
950 |
||
951 |
void CodeHeapAnalyticsDCmd::execute(DCmdSource source, TRAPS) { |
|
952 |
CompileBroker::print_heapinfo(output(), _function.value(), _granularity.value()); |
|
953 |
} |
|
954 |
||
955 |
int CodeHeapAnalyticsDCmd::num_arguments() { |
|
956 |
ResourceMark rm; |
|
957 |
CodeHeapAnalyticsDCmd* dcmd = new CodeHeapAnalyticsDCmd(NULL, false); |
|
958 |
if (dcmd != NULL) { |
|
959 |
DCmdMark mark(dcmd); |
|
960 |
return dcmd->_dcmdparser.num_arguments(); |
|
961 |
} else { |
|
962 |
return 0; |
|
963 |
} |
|
964 |
} |
|
965 |
//---< END >--- CodeHeap State Analytics. |
|
966 |
||
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
967 |
void CompilerDirectivesPrintDCmd::execute(DCmdSource source, TRAPS) { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
968 |
DirectivesStack::print(output()); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
969 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
970 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
971 |
CompilerDirectivesAddDCmd::CompilerDirectivesAddDCmd(outputStream* output, bool heap) : |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
972 |
DCmdWithParser(output, heap), |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
973 |
_filename("filename","Name of the directives file", "STRING",true) { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
974 |
_dcmdparser.add_dcmd_argument(&_filename); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
975 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
976 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
977 |
void CompilerDirectivesAddDCmd::execute(DCmdSource source, TRAPS) { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
978 |
DirectivesParser::parse_from_file(_filename.value(), output()); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
979 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
980 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
981 |
int CompilerDirectivesAddDCmd::num_arguments() { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
982 |
ResourceMark rm; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
983 |
CompilerDirectivesAddDCmd* dcmd = new CompilerDirectivesAddDCmd(NULL, false); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
984 |
if (dcmd != NULL) { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
985 |
DCmdMark mark(dcmd); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
986 |
return dcmd->_dcmdparser.num_arguments(); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
987 |
} else { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
988 |
return 0; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
989 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
990 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
991 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
992 |
void CompilerDirectivesRemoveDCmd::execute(DCmdSource source, TRAPS) { |
36597
ee256e343585
8150646: Add support for blocking compiles though whitebox API
simonis
parents:
36334
diff
changeset
|
993 |
DirectivesStack::pop(1); |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
994 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
995 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
996 |
void CompilerDirectivesClearDCmd::execute(DCmdSource source, TRAPS) { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
997 |
DirectivesStack::clear(); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33148
diff
changeset
|
998 |
} |
29071
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
999 |
#if INCLUDE_SERVICES |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1000 |
ClassHierarchyDCmd::ClassHierarchyDCmd(outputStream* output, bool heap) : |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1001 |
DCmdWithParser(output, heap), |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1002 |
_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
|
1003 |
_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
|
1004 |
"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
|
1005 |
_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
|
1006 |
"If not specified, all class hierarchies are printed.", |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1007 |
"STRING", false) { |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1008 |
_dcmdparser.add_dcmd_option(&_print_interfaces); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1009 |
_dcmdparser.add_dcmd_option(&_print_subclasses); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1010 |
_dcmdparser.add_dcmd_argument(&_classname); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1011 |
} |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1012 |
|
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1013 |
void ClassHierarchyDCmd::execute(DCmdSource source, TRAPS) { |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1014 |
VM_PrintClassHierarchy printClassHierarchyOp(output(), _print_interfaces.value(), |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1015 |
_print_subclasses.value(), _classname.value()); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1016 |
VMThread::execute(&printClassHierarchyOp); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1017 |
} |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1018 |
|
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1019 |
int ClassHierarchyDCmd::num_arguments() { |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1020 |
ResourceMark rm; |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1021 |
ClassHierarchyDCmd* dcmd = new ClassHierarchyDCmd(NULL, false); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1022 |
if (dcmd != NULL) { |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1023 |
DCmdMark mark(dcmd); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1024 |
return dcmd->_dcmdparser.num_arguments(); |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1025 |
} else { |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1026 |
return 0; |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1027 |
} |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1028 |
} |
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1029 |
|
73f45d04ad7a
8054888: Runtime: Add Diagnostic Command that prints the class hierarchy
cjplummer
parents:
28836
diff
changeset
|
1030 |
#endif |
31790 | 1031 |
|
1032 |
class VM_DumpTouchedMethods : public VM_Operation { |
|
1033 |
private: |
|
1034 |
outputStream* _out; |
|
1035 |
public: |
|
1036 |
VM_DumpTouchedMethods(outputStream* out) { |
|
1037 |
_out = out; |
|
1038 |
} |
|
1039 |
||
1040 |
virtual VMOp_Type type() const { return VMOp_DumpTouchedMethods; } |
|
1041 |
||
1042 |
virtual void doit() { |
|
1043 |
Method::print_touched_methods(_out); |
|
1044 |
} |
|
1045 |
}; |
|
1046 |
||
1047 |
TouchedMethodsDCmd::TouchedMethodsDCmd(outputStream* output, bool heap) : |
|
1048 |
DCmdWithParser(output, heap) |
|
1049 |
{} |
|
1050 |
||
1051 |
void TouchedMethodsDCmd::execute(DCmdSource source, TRAPS) { |
|
42075
e5b263ac8c2e
8168305: GC.class_stats should not require -XX:+UnlockDiagnosticVMOptions
sla
parents:
41078
diff
changeset
|
1052 |
if (!LogTouchedMethods) { |
e5b263ac8c2e
8168305: GC.class_stats should not require -XX:+UnlockDiagnosticVMOptions
sla
parents:
41078
diff
changeset
|
1053 |
output()->print_cr("VM.print_touched_methods command requires -XX:+LogTouchedMethods"); |
31790 | 1054 |
return; |
1055 |
} |
|
1056 |
VM_DumpTouchedMethods dumper(output()); |
|
1057 |
VMThread::execute(&dumper); |
|
1058 |
} |
|
1059 |
||
1060 |
int TouchedMethodsDCmd::num_arguments() { |
|
1061 |
return 0; |
|
1062 |
} |
|
52976 | 1063 |
|
1064 |
#if INCLUDE_JVMTI |
|
1065 |
extern "C" typedef char const* (JNICALL *debugInit_startDebuggingViaCommandPtr)(JNIEnv* env, jthread thread, char const** transport_name, |
|
1066 |
char const** address, jboolean* first_start); |
|
1067 |
static debugInit_startDebuggingViaCommandPtr dvc_start_ptr = NULL; |
|
1068 |
||
1069 |
DebugOnCmdStartDCmd::DebugOnCmdStartDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap) { |
|
1070 |
} |
|
1071 |
||
1072 |
void DebugOnCmdStartDCmd::execute(DCmdSource source, TRAPS) { |
|
1073 |
char const* transport = NULL; |
|
1074 |
char const* addr = NULL; |
|
1075 |
jboolean is_first_start = JNI_FALSE; |
|
1076 |
JavaThread* thread = (JavaThread*) THREAD; |
|
1077 |
jthread jt = JNIHandles::make_local(thread->threadObj()); |
|
1078 |
ThreadToNativeFromVM ttn(thread); |
|
1079 |
const char *error = "Could not find jdwp agent."; |
|
1080 |
||
1081 |
if (!dvc_start_ptr) { |
|
1082 |
for (AgentLibrary* agent = Arguments::agents(); agent != NULL; agent = agent->next()) { |
|
1083 |
if ((strcmp("jdwp", agent->name()) == 0) && (dvc_start_ptr == NULL)) { |
|
1084 |
char const* func = "debugInit_startDebuggingViaCommand"; |
|
1085 |
dvc_start_ptr = (debugInit_startDebuggingViaCommandPtr) os::find_agent_function(agent, false, &func, 1); |
|
1086 |
} |
|
1087 |
} |
|
1088 |
} |
|
1089 |
||
1090 |
if (dvc_start_ptr) { |
|
1091 |
error = dvc_start_ptr(thread->jni_environment(), jt, &transport, &addr, &is_first_start); |
|
1092 |
} |
|
1093 |
||
1094 |
if (error != NULL) { |
|
1095 |
output()->print_cr("Debugging has not been started: %s", error); |
|
1096 |
} else { |
|
1097 |
output()->print_cr(is_first_start ? "Debugging has been started." : "Debugging is already active."); |
|
1098 |
output()->print_cr("Transport : %s", transport ? transport : "#unknown"); |
|
1099 |
output()->print_cr("Address : %s", addr ? addr : "#unknown"); |
|
1100 |
} |
|
1101 |
} |
|
1102 |
#endif // INCLUDE_JVMTI |