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