2 * Interface for configuring and controlling the state of tracing events.
4 * Copyright (C) 2011-2016 LluĂs Vilanova <vilanova@ac.upc.edu>
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
10 #ifndef TRACE__CONTROL_INTERNAL_H
11 #define TRACE__CONTROL_INTERNAL_H
13 #include <stddef.h> /* size_t */
18 extern TraceEvent trace_events
[];
19 extern int trace_events_enabled_count
;
22 static inline bool trace_event_is_pattern(const char *str
)
25 return strchr(str
, '*') != NULL
;
28 static inline TraceEventID
trace_event_get_id(TraceEvent
*ev
)
34 static inline TraceEventVCPUID
trace_event_get_vcpu_id(TraceEvent
*ev
)
39 static inline bool trace_event_is_vcpu(TraceEvent
*ev
)
41 return ev
->vcpu_id
!= TRACE_VCPU_EVENT_COUNT
;
44 static inline const char * trace_event_get_name(TraceEvent
*ev
)
50 static inline bool trace_event_get_state_static(TraceEvent
*ev
)
56 /* it's on fast path, avoid consistency checks (asserts) */
57 #define trace_event_get_state_dynamic_by_id(id) \
58 (unlikely(trace_events_enabled_count) && _ ## id ## _DSTATE)
60 static inline bool trace_event_get_state_dynamic(TraceEvent
*ev
)
62 return unlikely(trace_events_enabled_count
) && *ev
->dstate
;
65 static inline bool trace_event_get_vcpu_state_dynamic_by_vcpu_id(CPUState
*vcpu
,
68 /* it's on fast path, avoid consistency checks (asserts) */
69 if (unlikely(trace_events_enabled_count
)) {
70 return test_bit(id
, vcpu
->trace_dstate
);
76 static inline bool trace_event_get_vcpu_state_dynamic(CPUState
*vcpu
,
80 assert(trace_event_is_vcpu(ev
));
81 id
= trace_event_get_vcpu_id(ev
);
82 return trace_event_get_vcpu_state_dynamic_by_vcpu_id(vcpu
, id
);
85 #endif /* TRACE__CONTROL_INTERNAL_H */