jvmtiEventController.inline.hpp revision 1472:c18cbe5936b8
10SN/A/*
20SN/A * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
30SN/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
40SN/A *
50SN/A * This code is free software; you can redistribute it and/or modify it
61113Sjoehw * under the terms of the GNU General Public License version 2 only, as
71113Sjoehw * published by the Free Software Foundation.
81113Sjoehw *
91113Sjoehw * This code is distributed in the hope that it will be useful, but WITHOUT
101113Sjoehw * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
111113Sjoehw * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
120SN/A * version 2 for more details (a copy is included in the LICENSE file that
131113Sjoehw * accompanied this code).
140SN/A *
150SN/A * You should have received a copy of the GNU General Public License version
160SN/A * 2 along with this work; if not, write to the Free Software Foundation,
170SN/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
180SN/A *
190SN/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
200SN/A * or visit www.oracle.com if you need additional information or have any
210SN/A * questions.
220SN/A *
230SN/A */
240SN/A
250SN/A// these inline functions are in a separate file to break include cycles
260SN/A
270SN/A
280SN/A///////////////////////////////////////////////////////////////
290SN/A//
300SN/A// JvmtiEventEnabled
310SN/A//
320SN/A
330SN/Ainline jlong JvmtiEventEnabled::bit_for(jvmtiEvent event_type) {
340SN/A  assert(JvmtiEventController::is_valid_event_type(event_type), "invalid event type");
350SN/A  return ((jlong)1) << (event_type - TOTAL_MIN_EVENT_TYPE_VAL);
360SN/A}
370SN/A
380SN/Ainline jlong JvmtiEventEnabled::get_bits() {
390SN/A  assert(_init_guard == JEE_INIT_GUARD, "enable bits uninitialized or corrupted");
400SN/A  return _enabled_bits;
410SN/A}
420SN/A
430SN/Ainline void JvmtiEventEnabled::set_bits(jlong bits) {
440SN/A  assert(_init_guard == JEE_INIT_GUARD, "enable bits uninitialized or corrupted on set");
450SN/A  _enabled_bits = bits;
460SN/A}
470SN/A
480SN/Ainline bool JvmtiEventEnabled::is_enabled(jvmtiEvent event_type) {
490SN/A  return (bit_for(event_type) & get_bits()) != 0;
500SN/A}
51
52
53///////////////////////////////////////////////////////////////
54//
55// JvmtiEnvThreadEventEnable
56//
57
58inline bool JvmtiEnvThreadEventEnable::is_enabled(jvmtiEvent event_type) {
59  assert(JvmtiUtil::event_threaded(event_type), "Only thread filtered events should be tested here");
60  return _event_enabled.is_enabled(event_type);
61}
62
63inline void JvmtiEnvThreadEventEnable::set_user_enabled(jvmtiEvent event_type, bool enabled) {
64  _event_user_enabled.set_enabled(event_type, enabled);
65}
66
67
68///////////////////////////////////////////////////////////////
69//
70// JvmtiThreadEventEnable
71//
72
73inline bool JvmtiThreadEventEnable::is_enabled(jvmtiEvent event_type) {
74  assert(JvmtiUtil::event_threaded(event_type), "Only thread filtered events should be tested here");
75  return _event_enabled.is_enabled(event_type);
76}
77
78
79///////////////////////////////////////////////////////////////
80//
81// JvmtiEnvEventEnable
82//
83
84inline bool JvmtiEnvEventEnable::is_enabled(jvmtiEvent event_type) {
85  assert(!JvmtiUtil::event_threaded(event_type), "Only non thread filtered events should be tested here");
86  return _event_enabled.is_enabled(event_type);
87}
88
89inline void JvmtiEnvEventEnable::set_user_enabled(jvmtiEvent event_type, bool enabled) {
90  _event_user_enabled.set_enabled(event_type, enabled);
91}
92
93
94///////////////////////////////////////////////////////////////
95//
96// JvmtiEventController
97//
98
99inline bool JvmtiEventController::is_enabled(jvmtiEvent event_type) {
100  return _universal_global_event_enabled.is_enabled(event_type);
101}
102