Path: blob/master/src/hotspot/share/jfr/jfr.cpp
41144 views
/*1* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "jfr/jfr.hpp"26#include "jfr/leakprofiler/leakProfiler.hpp"27#include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.inline.hpp"28#include "jfr/recorder/jfrRecorder.hpp"29#include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp"30#include "jfr/recorder/repository/jfrEmergencyDump.hpp"31#include "jfr/recorder/service/jfrOptionSet.hpp"32#include "jfr/recorder/repository/jfrRepository.hpp"33#include "jfr/support/jfrThreadLocal.hpp"34#include "runtime/interfaceSupport.inline.hpp"35#include "runtime/java.hpp"36#include "runtime/thread.hpp"3738bool Jfr::is_enabled() {39return JfrRecorder::is_enabled();40}4142bool Jfr::is_disabled() {43return JfrRecorder::is_disabled();44}4546bool Jfr::is_recording() {47return JfrRecorder::is_recording();48}4950void Jfr::on_create_vm_1() {51if (!JfrRecorder::on_create_vm_1()) {52vm_exit_during_initialization("Failure when starting JFR on_create_vm_1");53}54}5556void Jfr::on_create_vm_2() {57if (!JfrRecorder::on_create_vm_2()) {58vm_exit_during_initialization("Failure when starting JFR on_create_vm_2");59}60}6162void Jfr::on_create_vm_3() {63if (!JfrRecorder::on_create_vm_3()) {64vm_exit_during_initialization("Failure when starting JFR on_create_vm_3");65}66}6768void Jfr::on_unloading_classes() {69if (JfrRecorder::is_created()) {70JfrCheckpointManager::on_unloading_classes();71}72}7374void Jfr::on_thread_start(Thread* t) {75JfrThreadLocal::on_start(t);76}7778void Jfr::on_thread_exit(Thread* t) {79JfrThreadLocal::on_exit(t);80}8182void Jfr::exclude_thread(Thread* t) {83JfrThreadLocal::exclude(t);84}8586void Jfr::include_thread(Thread* t) {87JfrThreadLocal::include(t);88}8990bool Jfr::is_excluded(Thread* t) {91return t != NULL && t->jfr_thread_local()->is_excluded();92}9394void Jfr::on_vm_shutdown(bool exception_handler) {95if (JfrRecorder::is_recording()) {96JfrEmergencyDump::on_vm_shutdown(exception_handler);97}98}99100void Jfr::on_vm_error_report(outputStream* st) {101if (JfrRecorder::is_recording()) {102JfrRepository::on_vm_error_report(st);103}104}105106bool Jfr::on_flight_recorder_option(const JavaVMOption** option, char* delimiter) {107return JfrOptionSet::parse_flight_recorder_option(option, delimiter);108}109110bool Jfr::on_start_flight_recording_option(const JavaVMOption** option, char* delimiter) {111return JfrOptionSet::parse_start_flight_recording_option(option, delimiter);112}113114JRT_LEAF(void, Jfr::get_class_id_intrinsic(const Klass* klass))115assert(klass != NULL, "sanity");116JfrTraceIdLoadBarrier::load_barrier(klass);117JRT_END118119address Jfr::epoch_address() {120return JfrTraceIdEpoch::epoch_address();121}122123address Jfr::signal_address() {124return JfrTraceIdEpoch::signal_address();125}126127128