Fri, 12 Jun 2020 02:59:56 +0100
8233197: Invert JvmtiExport::post_vm_initialized() and Jfr:on_vm_start() start-up order for correct option parsing
8246703: [TESTBUG] Add test for JDK-8233197
Reviewed-by: aph, adinn, neugens
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_RECORDER_SERVICE_JFROPTIONSET_HPP |
apetushkov@9858 | 26 | #define SHARE_VM_JFR_RECORDER_SERVICE_JFROPTIONSET_HPP |
apetushkov@9858 | 27 | |
apetushkov@9858 | 28 | #include "jni.h" |
apetushkov@9858 | 29 | #include "memory/allocation.hpp" |
apetushkov@9858 | 30 | #include "utilities/exceptions.hpp" |
apetushkov@9858 | 31 | |
apetushkov@9858 | 32 | template <typename> |
apetushkov@9858 | 33 | class GrowableArray; |
apetushkov@9858 | 34 | |
apetushkov@9858 | 35 | // |
apetushkov@9858 | 36 | // Command-line options and defaults |
apetushkov@9858 | 37 | // |
apetushkov@9858 | 38 | class JfrOptionSet : public AllStatic { |
apetushkov@9858 | 39 | friend class JfrRecorder; |
apetushkov@9858 | 40 | private: |
apetushkov@9858 | 41 | static jlong _max_chunk_size; |
apetushkov@9858 | 42 | static jlong _global_buffer_size; |
apetushkov@9858 | 43 | static jlong _thread_buffer_size; |
apetushkov@9858 | 44 | static jlong _memory_size; |
apetushkov@9858 | 45 | static jlong _num_global_buffers; |
apetushkov@9858 | 46 | static jlong _old_object_queue_size; |
apetushkov@9858 | 47 | static u4 _stack_depth; |
apetushkov@9858 | 48 | static jboolean _sample_threads; |
apetushkov@9858 | 49 | static jboolean _retransform; |
apetushkov@9858 | 50 | static jboolean _sample_protection; |
apetushkov@9858 | 51 | |
apetushkov@9858 | 52 | static bool initialize(Thread* thread); |
apetushkov@9858 | 53 | static bool configure(TRAPS); |
apetushkov@9858 | 54 | static bool adjust_memory_options(); |
apetushkov@9858 | 55 | |
apetushkov@9858 | 56 | public: |
apetushkov@9858 | 57 | static jlong max_chunk_size(); |
apetushkov@9858 | 58 | static void set_max_chunk_size(jlong value); |
apetushkov@9858 | 59 | static jlong global_buffer_size(); |
apetushkov@9858 | 60 | static void set_global_buffer_size(jlong value); |
apetushkov@9858 | 61 | static jlong thread_buffer_size(); |
apetushkov@9858 | 62 | static void set_thread_buffer_size(jlong value); |
apetushkov@9858 | 63 | static jlong memory_size(); |
apetushkov@9858 | 64 | static void set_memory_size(jlong value); |
apetushkov@9858 | 65 | static jlong num_global_buffers(); |
apetushkov@9858 | 66 | static void set_num_global_buffers(jlong value); |
apetushkov@9858 | 67 | static jint old_object_queue_size(); |
apetushkov@9858 | 68 | static void set_old_object_queue_size(jlong value); |
apetushkov@9858 | 69 | static u4 stackdepth(); |
apetushkov@9858 | 70 | static void set_stackdepth(u4 depth); |
apetushkov@9858 | 71 | static bool sample_threads(); |
apetushkov@9858 | 72 | static void set_sample_threads(jboolean sample); |
apetushkov@9858 | 73 | static bool can_retransform(); |
apetushkov@9858 | 74 | static void set_retransform(jboolean value); |
apetushkov@9858 | 75 | static bool compressed_integers(); |
apetushkov@9858 | 76 | static bool allow_retransforms(); |
apetushkov@9858 | 77 | static bool allow_event_retransforms(); |
apetushkov@9858 | 78 | static bool sample_protection(); |
apetushkov@9858 | 79 | DEBUG_ONLY(static void set_sample_protection(jboolean protection);) |
apetushkov@9858 | 80 | |
apetushkov@9858 | 81 | static bool parse_flight_recorder_option(const JavaVMOption** option, char* delimiter); |
apetushkov@9858 | 82 | static bool parse_start_flight_recording_option(const JavaVMOption** option, char* delimiter); |
jbachorik@9925 | 83 | static const GrowableArray<const char*>* start_flight_recording_options(); |
jbachorik@9925 | 84 | static void release_start_flight_recording_options(); |
apetushkov@9858 | 85 | }; |
apetushkov@9858 | 86 | |
apetushkov@9858 | 87 | #endif // SHARE_VM_JFR_RECORDER_SERVICE_JFROPTIONSET_HPP |