1 /*
   2  * Copyright (c) 2014, 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_JNI_JFRJNIMETHOD_HPP
  26 #define SHARE_VM_JFR_JNI_JFRJNIMETHOD_HPP
  27 
  28 #include "jni.h"
  29 
  30 /*
  31  * Native methods for jdk.jfr.internal.JVM
  32  */
  33 
  34 #ifdef __cplusplus
  35 extern "C" {
  36 #endif
  37 
  38 jboolean JNICALL jfr_is_enabled();
  39 
  40 jboolean JNICALL jfr_is_disabled();
  41 
  42 jboolean JNICALL jfr_is_started();
  43 
  44 jlong JNICALL jfr_elapsed_counter(JNIEnv* env, jobject jvm);
  45 
  46 jboolean JNICALL jfr_create_jfr(JNIEnv* env, jobject jvm, jboolean simulate_failure);
  47 
  48 jboolean JNICALL jfr_destroy_jfr(JNIEnv* env, jobject jvm);
  49 
  50 void JNICALL jfr_begin_recording(JNIEnv* env, jobject jvm);
  51 
  52 void JNICALL jfr_end_recording(JNIEnv* env, jobject jvm);
  53 
  54 jboolean JNICALL jfr_emit_event(JNIEnv* env, jobject jvm, jlong eventTypeId, jlong timeStamp, jlong when);
  55 
  56 jobject JNICALL jfr_get_all_event_classes(JNIEnv* env, jobject jvm);
  57 
  58 jlong JNICALL jfr_class_id(JNIEnv* env, jclass jvm, jclass jc);
  59 
  60 jstring JNICALL jfr_get_pid(JNIEnv* env, jobject jvm);
  61 
  62 jlong JNICALL jfr_stacktrace_id(JNIEnv* env, jobject jvm, jint skip);
  63 
  64 jlong JNICALL jfr_elapsed_frequency(JNIEnv* env, jobject jvm);
  65 
  66 void JNICALL jfr_subscribe_log_level(JNIEnv* env, jobject jvm, jobject log_tag, jint id);
  67 
  68 void JNICALL jfr_log(JNIEnv* env, jobject jvm, jint tag_set, jint level, jstring message);
  69 
  70 void JNICALL jfr_retransform_classes(JNIEnv* env, jobject jvm, jobjectArray classes);
  71 
  72 void JNICALL jfr_set_enabled(JNIEnv* env, jobject jvm, jlong event_type_id, jboolean enabled);
  73 
  74 void JNICALL jfr_set_file_notification(JNIEnv* env, jobject jvm, jlong delta);
  75 
  76 void JNICALL jfr_set_global_buffer_count(JNIEnv* env, jobject jvm, jlong count);
  77 
  78 void JNICALL jfr_set_global_buffer_size(JNIEnv* env, jobject jvm, jlong size);
  79 
  80 void JNICALL jfr_set_method_sampling_interval(JNIEnv* env, jobject jvm, jlong type, jlong intervalMillis);
  81 
  82 void JNICALL jfr_set_output(JNIEnv* env, jobject jvm, jstring path);
  83 
  84 void JNICALL jfr_set_sample_threads(JNIEnv* env, jobject jvm, jboolean sampleThreads);
  85 
  86 void JNICALL jfr_set_stack_depth(JNIEnv* env, jobject jvm, jint depth);
  87 
  88 void JNICALL jfr_set_stacktrace_enabled(JNIEnv* env, jobject jvm, jlong event_type_id, jboolean enabled);
  89 
  90 void JNICALL jfr_set_thread_buffer_size(JNIEnv* env, jobject jvm, jlong size);
  91 
  92 void JNICALL jfr_set_memory_size(JNIEnv* env, jobject jvm, jlong size);
  93 
  94 jboolean JNICALL jfr_set_threshold(JNIEnv* env, jobject jvm, jlong event_type_id, jlong thresholdTicks);
  95 
  96 void JNICALL jfr_store_metadata_descriptor(JNIEnv* env, jobject jvm, jbyteArray descriptor);
  97 
  98 jlong JNICALL jfr_id_for_thread(JNIEnv* env, jobject jvm, jobject t);
  99 
 100 jboolean JNICALL jfr_allow_event_retransforms(JNIEnv* env, jobject jvm);
 101 
 102 jboolean JNICALL jfr_is_available(JNIEnv* env, jclass jvm);
 103 
 104 jdouble JNICALL jfr_time_conv_factor(JNIEnv* env, jobject jvm);
 105 
 106 jlong JNICALL jfr_type_id(JNIEnv* env, jobject jvm, jclass jc);
 107 
 108 void JNICALL jfr_set_repository_location(JNIEnv* env, jobject repo, jstring location);
 109 
 110 jobject JNICALL jfr_get_event_writer(JNIEnv* env, jclass cls);
 111 
 112 jobject JNICALL jfr_new_event_writer(JNIEnv* env, jclass cls);
 113 
 114 jboolean JNICALL jfr_event_writer_flush(JNIEnv* env, jclass cls, jobject writer, jint used_size, jint requested_size);
 115 
 116 void JNICALL jfr_abort(JNIEnv* env, jobject jvm, jstring errorMsg);
 117 
 118 jlong JNICALL jfr_get_epoch_address(JNIEnv* env, jobject jvm);
 119 
 120 jboolean JNICALL jfr_add_string_constant(JNIEnv* env, jclass jvm, jboolean epoch, jlong id, jstring string);
 121 
 122 void JNICALL jfr_uncaught_exception(JNIEnv* env, jobject jvm, jobject thread, jthrowable throwable);
 123 
 124 void JNICALL jfr_set_force_instrumentation(JNIEnv* env, jobject jvm, jboolean force);
 125 
 126 jlong JNICALL jfr_get_unloaded_event_classes_count(JNIEnv* env, jobject jvm);
 127 
 128 jboolean JNICALL jfr_set_cutoff(JNIEnv* env, jobject jvm, jlong event_type_id, jlong cutoff_ticks);
 129 
 130 void JNICALL jfr_emit_old_object_samples(JNIEnv* env, jobject jvm, jlong cutoff_ticks, jboolean);
 131 
 132 jboolean JNICALL jfr_should_rotate_disk(JNIEnv* env, jobject jvm);
 133 
 134 
 135 #ifdef __cplusplus
 136 }
 137 #endif
 138 
 139 #endif // SHARE_VM_JFR_JNI_JFRJNIMETHOD_HPP