Path: blob/master/src/hotspot/share/jfr/recorder/jfrEventSetting.cpp
41149 views
/*1* Copyright (c) 2012, 2020, 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/recorder/jfrEventSetting.inline.hpp"2627JfrNativeSettings JfrEventSetting::_jvm_event_settings;2829bool JfrEventSetting::set_threshold(jlong id, jlong threshold_ticks) {30JfrEventId event_id = (JfrEventId)id;31assert(bounds_check_event(event_id), "invariant");32setting(event_id).threshold_ticks = threshold_ticks;33return true;34}3536bool JfrEventSetting::set_cutoff(jlong id, jlong cutoff_ticks) {37JfrEventId event_id = (JfrEventId)id;38assert(bounds_check_event(event_id), "invariant");39setting(event_id).cutoff_ticks = cutoff_ticks;40return true;41}4243void JfrEventSetting::set_stacktrace(jlong id, bool enabled) {44JfrEventId event_id = (JfrEventId)id;45assert(bounds_check_event(event_id), "invariant");46setting(event_id).stacktrace = enabled;47}4849void JfrEventSetting::set_enabled(jlong id, bool enabled) {50JfrEventId event_id = (JfrEventId)id;51assert(bounds_check_event(event_id), "invariant");52setting(event_id).enabled = enabled;53}5455void JfrEventSetting::set_large(JfrEventId event_id) {56assert(bounds_check_event(event_id), "invariant");57setting(event_id).large = true;58}5960#ifdef ASSERT61bool JfrEventSetting::bounds_check_event(jlong id) {62if ((unsigned)id < FIRST_EVENT_ID) {63return false;64}65if ((unsigned)id > LAST_EVENT_ID) {66return false;67}68return true;69}70#endif // ASSERT717273