Fri, 23 Nov 2018 16:36:07 +0900
8213015: Inconsistent settings between JFR.configure and -XX:FlightRecorderOptions
Reviewed-by: mgronlun, egahlin
apetushkov@9858 | 1 | /* |
apetushkov@9858 | 2 | * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. |
apetushkov@9858 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
apetushkov@9858 | 4 | * |
apetushkov@9858 | 5 | * This code is free software; you can redistribute it and/or modify it |
apetushkov@9858 | 6 | * under the terms of the GNU General Public License version 2 only, as |
apetushkov@9858 | 7 | * published by the Free Software Foundation. |
apetushkov@9858 | 8 | * |
apetushkov@9858 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
apetushkov@9858 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
apetushkov@9858 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
apetushkov@9858 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
apetushkov@9858 | 13 | * accompanied this code). |
apetushkov@9858 | 14 | * |
apetushkov@9858 | 15 | * You should have received a copy of the GNU General Public License version |
apetushkov@9858 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
apetushkov@9858 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
apetushkov@9858 | 18 | * |
apetushkov@9858 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
apetushkov@9858 | 20 | * or visit www.oracle.com if you need additional information or have any |
apetushkov@9858 | 21 | * questions. |
apetushkov@9858 | 22 | * |
apetushkov@9858 | 23 | */ |
apetushkov@9858 | 24 | |
apetushkov@9858 | 25 | #ifndef SHARE_VM_JFR_JFRDCMDS_HPP |
apetushkov@9858 | 26 | #define SHARE_VM_JFR_JFRDCMDS_HPP |
apetushkov@9858 | 27 | |
apetushkov@9858 | 28 | #include "services/diagnosticCommand.hpp" |
apetushkov@9858 | 29 | |
apetushkov@9858 | 30 | class JfrDumpFlightRecordingDCmd : public DCmdWithParser { |
apetushkov@9858 | 31 | protected: |
apetushkov@9858 | 32 | DCmdArgument<char*> _name; |
apetushkov@9858 | 33 | DCmdArgument<char*> _filename; |
apetushkov@9858 | 34 | DCmdArgument<NanoTimeArgument> _maxage; |
apetushkov@9858 | 35 | DCmdArgument<MemorySizeArgument> _maxsize; |
apetushkov@9858 | 36 | DCmdArgument<char*> _begin; |
apetushkov@9858 | 37 | DCmdArgument<char*> _end; |
apetushkov@9858 | 38 | DCmdArgument<bool> _path_to_gc_roots; |
apetushkov@9858 | 39 | |
apetushkov@9858 | 40 | public: |
apetushkov@9858 | 41 | JfrDumpFlightRecordingDCmd(outputStream* output, bool heap); |
apetushkov@9858 | 42 | static const char* name() { |
apetushkov@9858 | 43 | return "JFR.dump"; |
apetushkov@9858 | 44 | } |
apetushkov@9858 | 45 | static const char* description() { |
apetushkov@9858 | 46 | return "Copies contents of a JFR recording to file. Either the name or the recording id must be specified."; |
apetushkov@9858 | 47 | } |
apetushkov@9858 | 48 | static const char* impact() { |
apetushkov@9858 | 49 | return "Low"; |
apetushkov@9858 | 50 | } |
apetushkov@9858 | 51 | static const JavaPermission permission() { |
apetushkov@9858 | 52 | JavaPermission p = {"java.lang.management.ManagementPermission", "monitor", NULL}; |
apetushkov@9858 | 53 | return p; |
apetushkov@9858 | 54 | } |
apetushkov@9858 | 55 | static int num_arguments(); |
apetushkov@9858 | 56 | virtual void execute(DCmdSource source, TRAPS); |
apetushkov@9858 | 57 | }; |
apetushkov@9858 | 58 | |
apetushkov@9858 | 59 | class JfrCheckFlightRecordingDCmd : public DCmdWithParser { |
apetushkov@9858 | 60 | protected: |
apetushkov@9858 | 61 | DCmdArgument<char*> _name; |
apetushkov@9858 | 62 | DCmdArgument<bool> _verbose; |
apetushkov@9858 | 63 | |
apetushkov@9858 | 64 | public: |
apetushkov@9858 | 65 | JfrCheckFlightRecordingDCmd(outputStream* output, bool heap); |
apetushkov@9858 | 66 | static const char* name() { |
apetushkov@9858 | 67 | return "JFR.check"; |
apetushkov@9858 | 68 | } |
apetushkov@9858 | 69 | static const char* description() { |
apetushkov@9858 | 70 | return "Checks running JFR recording(s)"; |
apetushkov@9858 | 71 | } |
apetushkov@9858 | 72 | static const char* impact() { |
apetushkov@9858 | 73 | return "Low"; |
apetushkov@9858 | 74 | } |
apetushkov@9858 | 75 | static const JavaPermission permission() { |
apetushkov@9858 | 76 | JavaPermission p = {"java.lang.management.ManagementPermission", "monitor", NULL}; |
apetushkov@9858 | 77 | return p; |
apetushkov@9858 | 78 | } |
apetushkov@9858 | 79 | static int num_arguments(); |
apetushkov@9858 | 80 | virtual void execute(DCmdSource source, TRAPS); |
apetushkov@9858 | 81 | }; |
apetushkov@9858 | 82 | |
apetushkov@9858 | 83 | class JfrStartFlightRecordingDCmd : public DCmdWithParser { |
apetushkov@9858 | 84 | protected: |
apetushkov@9858 | 85 | DCmdArgument<char*> _name; |
apetushkov@9858 | 86 | DCmdArgument<StringArrayArgument*> _settings; |
apetushkov@9858 | 87 | DCmdArgument<NanoTimeArgument> _delay; |
apetushkov@9858 | 88 | DCmdArgument<NanoTimeArgument> _duration; |
apetushkov@9858 | 89 | DCmdArgument<bool> _disk; |
apetushkov@9858 | 90 | DCmdArgument<char*> _filename; |
apetushkov@9858 | 91 | DCmdArgument<NanoTimeArgument> _maxage; |
apetushkov@9858 | 92 | DCmdArgument<MemorySizeArgument> _maxsize; |
apetushkov@9858 | 93 | DCmdArgument<bool> _dump_on_exit; |
apetushkov@9858 | 94 | DCmdArgument<bool> _path_to_gc_roots; |
apetushkov@9858 | 95 | |
apetushkov@9858 | 96 | public: |
apetushkov@9858 | 97 | JfrStartFlightRecordingDCmd(outputStream* output, bool heap); |
apetushkov@9858 | 98 | static const char* name() { |
apetushkov@9858 | 99 | return "JFR.start"; |
apetushkov@9858 | 100 | } |
apetushkov@9858 | 101 | static const char* description() { |
apetushkov@9858 | 102 | return "Starts a new JFR recording"; |
apetushkov@9858 | 103 | } |
apetushkov@9858 | 104 | static const char* impact() { |
apetushkov@9858 | 105 | return "Medium: Depending on the settings for a recording, the impact can range from low to high."; |
apetushkov@9858 | 106 | } |
apetushkov@9858 | 107 | static const JavaPermission permission() { |
apetushkov@9858 | 108 | JavaPermission p = {"java.lang.management.ManagementPermission", "monitor", NULL}; |
apetushkov@9858 | 109 | return p; |
apetushkov@9858 | 110 | } |
apetushkov@9858 | 111 | static int num_arguments(); |
apetushkov@9858 | 112 | virtual void execute(DCmdSource source, TRAPS); |
apetushkov@9858 | 113 | }; |
apetushkov@9858 | 114 | |
apetushkov@9858 | 115 | class JfrStopFlightRecordingDCmd : public DCmdWithParser { |
apetushkov@9858 | 116 | protected: |
apetushkov@9858 | 117 | DCmdArgument<char*> _name; |
apetushkov@9858 | 118 | DCmdArgument<char*> _filename; |
apetushkov@9858 | 119 | |
apetushkov@9858 | 120 | public: |
apetushkov@9858 | 121 | JfrStopFlightRecordingDCmd(outputStream* output, bool heap); |
apetushkov@9858 | 122 | static const char* name() { |
apetushkov@9858 | 123 | return "JFR.stop"; |
apetushkov@9858 | 124 | } |
apetushkov@9858 | 125 | static const char* description() { |
apetushkov@9858 | 126 | return "Stops a JFR recording"; |
apetushkov@9858 | 127 | } |
apetushkov@9858 | 128 | static const char* impact() { |
apetushkov@9858 | 129 | return "Low"; |
apetushkov@9858 | 130 | } |
apetushkov@9858 | 131 | static const JavaPermission permission() { |
apetushkov@9858 | 132 | JavaPermission p = {"java.lang.management.ManagementPermission", "monitor", NULL}; |
apetushkov@9858 | 133 | return p; |
apetushkov@9858 | 134 | } |
apetushkov@9858 | 135 | static int num_arguments(); |
apetushkov@9858 | 136 | virtual void execute(DCmdSource source, TRAPS); |
apetushkov@9858 | 137 | }; |
apetushkov@9858 | 138 | |
apetushkov@9858 | 139 | class JfrRuntimeOptions; |
apetushkov@9858 | 140 | |
apetushkov@9858 | 141 | class JfrConfigureFlightRecorderDCmd : public DCmdWithParser { |
apetushkov@9858 | 142 | friend class JfrOptionSet; |
apetushkov@9858 | 143 | protected: |
apetushkov@9858 | 144 | DCmdArgument<char*> _repository_path; |
apetushkov@9858 | 145 | DCmdArgument<char*> _dump_path; |
apetushkov@9858 | 146 | DCmdArgument<jlong> _stack_depth; |
apetushkov@9858 | 147 | DCmdArgument<jlong> _global_buffer_count; |
ysuenaga@9870 | 148 | DCmdArgument<MemorySizeArgument> _global_buffer_size; |
ysuenaga@9870 | 149 | DCmdArgument<MemorySizeArgument> _thread_buffer_size; |
ysuenaga@9870 | 150 | DCmdArgument<MemorySizeArgument> _memory_size; |
ysuenaga@9870 | 151 | DCmdArgument<MemorySizeArgument> _max_chunk_size; |
apetushkov@9858 | 152 | DCmdArgument<bool> _sample_threads; |
apetushkov@9858 | 153 | |
apetushkov@9858 | 154 | public: |
apetushkov@9858 | 155 | JfrConfigureFlightRecorderDCmd(outputStream* output, bool heap); |
apetushkov@9858 | 156 | static const char* name() { |
apetushkov@9858 | 157 | return "JFR.configure"; |
apetushkov@9858 | 158 | } |
apetushkov@9858 | 159 | static const char* description() { |
apetushkov@9858 | 160 | return "Configure JFR"; |
apetushkov@9858 | 161 | } |
apetushkov@9858 | 162 | static const char* impact() { |
apetushkov@9858 | 163 | return "Low"; |
apetushkov@9858 | 164 | } |
apetushkov@9858 | 165 | static const JavaPermission permission() { |
apetushkov@9858 | 166 | JavaPermission p = {"java.lang.management.ManagementPermission", "monitor", NULL}; |
apetushkov@9858 | 167 | return p; |
apetushkov@9858 | 168 | } |
apetushkov@9858 | 169 | static int num_arguments(); |
apetushkov@9858 | 170 | virtual void execute(DCmdSource source, TRAPS); |
apetushkov@9858 | 171 | }; |
apetushkov@9858 | 172 | |
apetushkov@9858 | 173 | class JfrUnlockCommercialFeaturesDCmd : public DCmd { |
apetushkov@9858 | 174 | public: |
apetushkov@9858 | 175 | JfrUnlockCommercialFeaturesDCmd(outputStream* output, bool heap) : DCmd(output, heap) { } |
apetushkov@9858 | 176 | static const char* name() { return "VM.unlock_commercial_features"; } |
apetushkov@9858 | 177 | static const char* description() { |
apetushkov@9858 | 178 | return "Simulate commercial features unlocking for Zulu."; |
apetushkov@9858 | 179 | } |
apetushkov@9858 | 180 | static const char* impact() { return "Low"; } |
apetushkov@9858 | 181 | static const JavaPermission permission() { |
apetushkov@9858 | 182 | JavaPermission p = {"java.lang.management.ManagementPermission", |
apetushkov@9858 | 183 | "monitor", NULL}; |
apetushkov@9858 | 184 | return p; |
apetushkov@9858 | 185 | } |
apetushkov@9858 | 186 | static int num_arguments() { return 0; } |
apetushkov@9858 | 187 | virtual void execute(DCmdSource source, TRAPS) { |
apetushkov@9858 | 188 | UnlockCommercialFeatures = true; |
apetushkov@9858 | 189 | } |
apetushkov@9858 | 190 | }; |
apetushkov@9858 | 191 | |
apetushkov@9858 | 192 | bool register_jfr_dcmds(); |
apetushkov@9858 | 193 | |
apetushkov@9858 | 194 | #endif // SHARE_VM_JFR_JFRDCMDS_HPP |