1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/jfr/dcmd/jfrDcmds.hpp Mon Aug 12 18:30:40 2019 +0300 1.3 @@ -0,0 +1,194 @@ 1.4 +/* 1.5 + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +#ifndef SHARE_VM_JFR_JFRDCMDS_HPP 1.29 +#define SHARE_VM_JFR_JFRDCMDS_HPP 1.30 + 1.31 +#include "services/diagnosticCommand.hpp" 1.32 + 1.33 +class JfrDumpFlightRecordingDCmd : public DCmdWithParser { 1.34 + protected: 1.35 + DCmdArgument<char*> _name; 1.36 + DCmdArgument<char*> _filename; 1.37 + DCmdArgument<NanoTimeArgument> _maxage; 1.38 + DCmdArgument<MemorySizeArgument> _maxsize; 1.39 + DCmdArgument<char*> _begin; 1.40 + DCmdArgument<char*> _end; 1.41 + DCmdArgument<bool> _path_to_gc_roots; 1.42 + 1.43 + public: 1.44 + JfrDumpFlightRecordingDCmd(outputStream* output, bool heap); 1.45 + static const char* name() { 1.46 + return "JFR.dump"; 1.47 + } 1.48 + static const char* description() { 1.49 + return "Copies contents of a JFR recording to file. Either the name or the recording id must be specified."; 1.50 + } 1.51 + static const char* impact() { 1.52 + return "Low"; 1.53 + } 1.54 + static const JavaPermission permission() { 1.55 + JavaPermission p = {"java.lang.management.ManagementPermission", "monitor", NULL}; 1.56 + return p; 1.57 + } 1.58 + static int num_arguments(); 1.59 + virtual void execute(DCmdSource source, TRAPS); 1.60 +}; 1.61 + 1.62 +class JfrCheckFlightRecordingDCmd : public DCmdWithParser { 1.63 + protected: 1.64 + DCmdArgument<char*> _name; 1.65 + DCmdArgument<bool> _verbose; 1.66 + 1.67 + public: 1.68 + JfrCheckFlightRecordingDCmd(outputStream* output, bool heap); 1.69 + static const char* name() { 1.70 + return "JFR.check"; 1.71 + } 1.72 + static const char* description() { 1.73 + return "Checks running JFR recording(s)"; 1.74 + } 1.75 + static const char* impact() { 1.76 + return "Low"; 1.77 + } 1.78 + static const JavaPermission permission() { 1.79 + JavaPermission p = {"java.lang.management.ManagementPermission", "monitor", NULL}; 1.80 + return p; 1.81 + } 1.82 + static int num_arguments(); 1.83 + virtual void execute(DCmdSource source, TRAPS); 1.84 +}; 1.85 + 1.86 +class JfrStartFlightRecordingDCmd : public DCmdWithParser { 1.87 + protected: 1.88 + DCmdArgument<char*> _name; 1.89 + DCmdArgument<StringArrayArgument*> _settings; 1.90 + DCmdArgument<NanoTimeArgument> _delay; 1.91 + DCmdArgument<NanoTimeArgument> _duration; 1.92 + DCmdArgument<bool> _disk; 1.93 + DCmdArgument<char*> _filename; 1.94 + DCmdArgument<NanoTimeArgument> _maxage; 1.95 + DCmdArgument<MemorySizeArgument> _maxsize; 1.96 + DCmdArgument<bool> _dump_on_exit; 1.97 + DCmdArgument<bool> _path_to_gc_roots; 1.98 + 1.99 + public: 1.100 + JfrStartFlightRecordingDCmd(outputStream* output, bool heap); 1.101 + static const char* name() { 1.102 + return "JFR.start"; 1.103 + } 1.104 + static const char* description() { 1.105 + return "Starts a new JFR recording"; 1.106 + } 1.107 + static const char* impact() { 1.108 + return "Medium: Depending on the settings for a recording, the impact can range from low to high."; 1.109 + } 1.110 + static const JavaPermission permission() { 1.111 + JavaPermission p = {"java.lang.management.ManagementPermission", "monitor", NULL}; 1.112 + return p; 1.113 + } 1.114 + static int num_arguments(); 1.115 + virtual void execute(DCmdSource source, TRAPS); 1.116 +}; 1.117 + 1.118 +class JfrStopFlightRecordingDCmd : public DCmdWithParser { 1.119 + protected: 1.120 + DCmdArgument<char*> _name; 1.121 + DCmdArgument<char*> _filename; 1.122 + 1.123 + public: 1.124 + JfrStopFlightRecordingDCmd(outputStream* output, bool heap); 1.125 + static const char* name() { 1.126 + return "JFR.stop"; 1.127 + } 1.128 + static const char* description() { 1.129 + return "Stops a JFR recording"; 1.130 + } 1.131 + static const char* impact() { 1.132 + return "Low"; 1.133 + } 1.134 + static const JavaPermission permission() { 1.135 + JavaPermission p = {"java.lang.management.ManagementPermission", "monitor", NULL}; 1.136 + return p; 1.137 + } 1.138 + static int num_arguments(); 1.139 + virtual void execute(DCmdSource source, TRAPS); 1.140 +}; 1.141 + 1.142 +class JfrRuntimeOptions; 1.143 + 1.144 +class JfrConfigureFlightRecorderDCmd : public DCmdWithParser { 1.145 + friend class JfrOptionSet; 1.146 + protected: 1.147 + DCmdArgument<char*> _repository_path; 1.148 + DCmdArgument<char*> _dump_path; 1.149 + DCmdArgument<jlong> _stack_depth; 1.150 + DCmdArgument<jlong> _global_buffer_count; 1.151 + DCmdArgument<jlong> _global_buffer_size; 1.152 + DCmdArgument<jlong> _thread_buffer_size; 1.153 + DCmdArgument<jlong> _memory_size; 1.154 + DCmdArgument<jlong> _max_chunk_size; 1.155 + DCmdArgument<bool> _sample_threads; 1.156 + 1.157 + public: 1.158 + JfrConfigureFlightRecorderDCmd(outputStream* output, bool heap); 1.159 + static const char* name() { 1.160 + return "JFR.configure"; 1.161 + } 1.162 + static const char* description() { 1.163 + return "Configure JFR"; 1.164 + } 1.165 + static const char* impact() { 1.166 + return "Low"; 1.167 + } 1.168 + static const JavaPermission permission() { 1.169 + JavaPermission p = {"java.lang.management.ManagementPermission", "monitor", NULL}; 1.170 + return p; 1.171 + } 1.172 + static int num_arguments(); 1.173 + virtual void execute(DCmdSource source, TRAPS); 1.174 +}; 1.175 + 1.176 +class JfrUnlockCommercialFeaturesDCmd : public DCmd { 1.177 +public: 1.178 + JfrUnlockCommercialFeaturesDCmd(outputStream* output, bool heap) : DCmd(output, heap) { } 1.179 + static const char* name() { return "VM.unlock_commercial_features"; } 1.180 + static const char* description() { 1.181 + return "Simulate commercial features unlocking for Zulu."; 1.182 + } 1.183 + static const char* impact() { return "Low"; } 1.184 + static const JavaPermission permission() { 1.185 + JavaPermission p = {"java.lang.management.ManagementPermission", 1.186 + "monitor", NULL}; 1.187 + return p; 1.188 + } 1.189 + static int num_arguments() { return 0; } 1.190 + virtual void execute(DCmdSource source, TRAPS) { 1.191 + UnlockCommercialFeatures = true; 1.192 + } 1.193 +}; 1.194 + 1.195 +bool register_jfr_dcmds(); 1.196 + 1.197 +#endif // SHARE_VM_JFR_JFRDCMDS_HPP