1 /*
   2  * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
   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 #ifndef SHARE_VM_JFR_RECORDER_ACCESS_JFROPTIONSET_HPP
  26 #define SHARE_VM_JFR_RECORDER_ACCESS_JFROPTIONSET_HPP
  27 
  28 #include "jni.h"
  29 #include "memory/allocation.hpp"
  30 #include "utilities/exceptions.hpp"
  31 
  32 //
  33 // Command-line options and defaults
  34 //
  35 class JfrOptionSet : public AllStatic {
  36   friend class JfrRecorder;
  37  private:
  38   static jlong _max_chunk_size;
  39   static jlong _global_buffer_size;
  40   static jlong _thread_buffer_size;
  41   static jlong _memory_size;
  42   static jlong _num_global_buffers;
  43   static jlong _old_object_queue_size;
  44   static u4 _stack_depth;
  45   static jboolean _sample_threads;
  46   static jboolean _retransform;
  47   static jboolean _sample_protection;
  48 
  49   static bool initialize(Thread* thread);
  50   static bool configure(TRAPS);
  51   static bool adjust_memory_options();
  52 
  53  public:
  54   static jlong max_chunk_size();
  55   static void set_max_chunk_size(jlong value);
  56   static jlong global_buffer_size();
  57   static void set_global_buffer_size(jlong value);
  58   static jlong thread_buffer_size();
  59   static void set_thread_buffer_size(jlong value);
  60   static jlong memory_size();
  61   static void set_memory_size(jlong value);
  62   static jlong num_global_buffers();
  63   static void set_num_global_buffers(jlong value);
  64   static jint old_object_queue_size();
  65   static void set_old_object_queue_size(jlong value);
  66   static u4 stackdepth();
  67   static void set_stackdepth(u4 depth);
  68   static bool sample_threads();
  69   static void set_sample_threads(jboolean sample);
  70   static bool can_retransform();
  71   static void set_retransform(jboolean value);
  72   static bool compressed_integers();
  73   static bool allow_retransforms();
  74   static bool allow_event_retransforms();
  75   static bool sample_protection();
  76   DEBUG_ONLY(static void set_sample_protection(jboolean protection);)
  77 
  78   static bool parse_start_flight_recording(const JavaVMOption** option, char* tail);
  79   static bool parse_flight_recorder_options(const JavaVMOption** option, char* tail);
  80 
  81 };
  82 
  83 #endif // SHARE_VM_JFR_RECORDER_ACCESS_JFROPTIONSET_HPP