Merge tag 'nvme-next-pull-request' of https://gitlab.com/birkelund/qemu into staging
[qemu/ar7.git] / trace / control-internal.h
blob8d818d359becfb2bd26648ee01abda5efaeb124f
1 /*
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.
8 */
10 #ifndef TRACE__CONTROL_INTERNAL_H
11 #define TRACE__CONTROL_INTERNAL_H
13 extern int trace_events_enabled_count;
16 static inline bool trace_event_is_pattern(const char *str)
18 assert(str != NULL);
19 return strchr(str, '*') != NULL;
22 static inline uint32_t trace_event_get_id(TraceEvent *ev)
24 assert(ev != NULL);
25 return ev->id;
28 static inline const char * trace_event_get_name(TraceEvent *ev)
30 assert(ev != NULL);
31 return ev->name;
34 static inline bool trace_event_get_state_static(TraceEvent *ev)
36 assert(ev != NULL);
37 return ev->sstate;
40 /* it's on fast path, avoid consistency checks (asserts) */
41 #define trace_event_get_state_dynamic_by_id(id) \
42 (unlikely(trace_events_enabled_count) && _ ## id ## _DSTATE)
44 static inline bool trace_event_get_state_dynamic(TraceEvent *ev)
46 return unlikely(trace_events_enabled_count) && *ev->dstate;
49 void trace_event_register_group(TraceEvent **events);
51 #endif /* TRACE__CONTROL_INTERNAL_H */