Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/jfr/jfr.cpp
32285 views
/*1* Copyright (c) 2018, 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/periodic/sampling/jfrThreadSampler.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/support/jfrThreadLocal.hpp"33#include "runtime/java.hpp"3435bool Jfr::is_enabled() {36return JfrRecorder::is_enabled();37}3839bool Jfr::is_disabled() {40return JfrRecorder::is_disabled();41}4243bool Jfr::is_recording() {44return JfrRecorder::is_recording();45}4647void Jfr::on_vm_init() {48if (!JfrRecorder::on_vm_init()) {49vm_exit_during_initialization("Failure when starting JFR on_vm_init");50}51}5253void Jfr::on_vm_start() {54if (!JfrRecorder::on_vm_start()) {55vm_exit_during_initialization("Failure when starting JFR on_vm_start");56}57}5859void Jfr::on_unloading_classes() {60if (JfrRecorder::is_created()) {61JfrCheckpointManager::write_type_set_for_unloaded_classes();62}63}6465void Jfr::on_thread_start(Thread* t) {66JfrThreadLocal::on_start(t);67}6869void Jfr::on_thread_exit(Thread* t) {70JfrThreadLocal::on_exit(t);71}7273void Jfr::on_java_thread_dismantle(JavaThread* jt) {74if (JfrRecorder::is_recording()) {75JfrCheckpointManager::write_thread_checkpoint(jt);76}77}7879void Jfr::on_vm_shutdown(bool exception_handler) {80JfrRecorder::set_is_shutting_down();81if (JfrRecorder::is_recording()) {82JfrEmergencyDump::on_vm_shutdown(exception_handler);83}84}8586void Jfr::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f) {87LeakProfiler::oops_do(is_alive, f);88}8990void Jfr::weak_oops_do(OopClosure* f) {91AlwaysTrueClosure always_true;92LeakProfiler::oops_do(&always_true, f);93}9495bool Jfr::on_flight_recorder_option(const JavaVMOption** option, char* delimiter) {96return JfrOptionSet::parse_flight_recorder_option(option, delimiter);97}9899bool Jfr::on_start_flight_recording_option(const JavaVMOption** option, char* delimiter) {100return JfrOptionSet::parse_start_flight_recording_option(option, delimiter);101}102103Thread* Jfr::sampler_thread() {104return JfrThreadSampling::sampler_thread();105}106107108