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"
26 #include "classfile/classLoaderStats.hpp"
27 #include "classfile/compactHashtable.hpp"
28 #include "gc/shared/vmGCOperations.hpp"
29 #include "oops/oop.inline.hpp"
30 #include "runtime/javaCalls.hpp"
31 #include "runtime/os.hpp"
32 #include "services/diagnosticArgument.hpp"
33 #include "services/diagnosticCommand.hpp"
34 #include "services/diagnosticFramework.hpp"
35 #include "services/heapDumper.hpp"
36 #include "services/management.hpp"
37 #include "services/writeableFlags.hpp"
38 #include "utilities/macros.hpp"
39
40 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
41
42 void DCmdRegistrant::register_dcmds(){
43 // Registration of the diagnostic commands
44 // First argument specifies which interfaces will export the command
45 // Second argument specifies if the command is enabled
46 // Third argument specifies if the command is hidden
47 uint32_t full_export = DCmd_Source_Internal | DCmd_Source_AttachAPI
48 | DCmd_Source_MBean;
49 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HelpDCmd>(full_export, true, false));
204 }
205
206 SetVMFlagDCmd::SetVMFlagDCmd(outputStream* output, bool heap) :
207 DCmdWithParser(output, heap),
208 _flag("flag name", "The name of the flag we want to set",
209 "STRING", true),
210 _value("string value", "The value we want to set", "STRING", false) {
211 _dcmdparser.add_dcmd_argument(&_flag);
212 _dcmdparser.add_dcmd_argument(&_value);
213 }
214
215 void SetVMFlagDCmd::execute(DCmdSource source, TRAPS) {
216 const char* val = NULL;
217 if (_value.value() != NULL) {
218 val = _value.value();
219 }
220
221 FormatBuffer<80> err_msg("%s", "");
222 int ret = WriteableFlags::set_flag(_flag.value(), val, Flag::MANAGEMENT, err_msg);
223
224 if (ret != WriteableFlags::SUCCESS) {
225 output()->print_cr("%s", err_msg.buffer());
226 }
227 }
228
229 int SetVMFlagDCmd::num_arguments() {
230 ResourceMark rm;
231 SetVMFlagDCmd* dcmd = new SetVMFlagDCmd(NULL, false);
232 if (dcmd != NULL) {
233 DCmdMark mark(dcmd);
234 return dcmd->_dcmdparser.num_arguments();
235 } else {
236 return 0;
237 }
238 }
239
240 void JVMTIDataDumpDCmd::execute(DCmdSource source, TRAPS) {
241 if (JvmtiExport::should_post_data_dump()) {
242 JvmtiExport::post_data_dump();
243 }
244 }
|
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"
26 #include "classfile/classLoaderStats.hpp"
27 #include "classfile/compactHashtable.hpp"
28 #include "gc/shared/vmGCOperations.hpp"
29 #include "oops/oop.inline.hpp"
30 #include "runtime/globals.hpp"
31 #include "runtime/javaCalls.hpp"
32 #include "runtime/os.hpp"
33 #include "services/diagnosticArgument.hpp"
34 #include "services/diagnosticCommand.hpp"
35 #include "services/diagnosticFramework.hpp"
36 #include "services/heapDumper.hpp"
37 #include "services/management.hpp"
38 #include "services/writeableFlags.hpp"
39 #include "utilities/macros.hpp"
40
41 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
42
43 void DCmdRegistrant::register_dcmds(){
44 // Registration of the diagnostic commands
45 // First argument specifies which interfaces will export the command
46 // Second argument specifies if the command is enabled
47 // Third argument specifies if the command is hidden
48 uint32_t full_export = DCmd_Source_Internal | DCmd_Source_AttachAPI
49 | DCmd_Source_MBean;
50 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HelpDCmd>(full_export, true, false));
205 }
206
207 SetVMFlagDCmd::SetVMFlagDCmd(outputStream* output, bool heap) :
208 DCmdWithParser(output, heap),
209 _flag("flag name", "The name of the flag we want to set",
210 "STRING", true),
211 _value("string value", "The value we want to set", "STRING", false) {
212 _dcmdparser.add_dcmd_argument(&_flag);
213 _dcmdparser.add_dcmd_argument(&_value);
214 }
215
216 void SetVMFlagDCmd::execute(DCmdSource source, TRAPS) {
217 const char* val = NULL;
218 if (_value.value() != NULL) {
219 val = _value.value();
220 }
221
222 FormatBuffer<80> err_msg("%s", "");
223 int ret = WriteableFlags::set_flag(_flag.value(), val, Flag::MANAGEMENT, err_msg);
224
225 if (ret != Flag::SUCCESS) {
226 output()->print_cr("%s", err_msg.buffer());
227 }
228 }
229
230 int SetVMFlagDCmd::num_arguments() {
231 ResourceMark rm;
232 SetVMFlagDCmd* dcmd = new SetVMFlagDCmd(NULL, false);
233 if (dcmd != NULL) {
234 DCmdMark mark(dcmd);
235 return dcmd->_dcmdparser.num_arguments();
236 } else {
237 return 0;
238 }
239 }
240
241 void JVMTIDataDumpDCmd::execute(DCmdSource source, TRAPS) {
242 if (JvmtiExport::should_post_data_dump()) {
243 JvmtiExport::post_data_dump();
244 }
245 }
|