net/cadence_gem: Don't assert against 0 buffer address
[qemu.git] / trace / control-internal.h
blobcce2da47c44c75f56df3c25597956cf1f05c6853
1 /*
2 * Interface for configuring and controlling the state of tracing events.
4 * Copyright (C) 2011-2012 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 #include <string.h>
16 extern TraceEvent trace_events[];
19 static inline TraceEvent *trace_event_id(TraceEventID id)
21 assert(id < trace_event_count());
22 return &trace_events[id];
25 static inline TraceEventID trace_event_count(void)
27 return TRACE_EVENT_COUNT;
30 static inline bool trace_event_is_pattern(const char *str)
32 assert(str != NULL);
33 return strchr(str, '*') != NULL;
36 static inline TraceEventID trace_event_get_id(TraceEvent *ev)
38 assert(ev != NULL);
39 return ev->id;
42 static inline const char * trace_event_get_name(TraceEvent *ev)
44 assert(ev != NULL);
45 return ev->name;
48 static inline bool trace_event_get_state_static(TraceEvent *ev)
50 assert(ev != NULL);
51 return ev->sstate;
54 static inline bool trace_event_get_state_dynamic(TraceEvent *ev)
56 assert(ev != NULL);
57 return ev->dstate;
60 static inline void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
62 assert(ev != NULL);
63 assert(trace_event_get_state_static(ev));
64 return trace_event_set_state_dynamic_backend(ev, state);
67 #endif /* TRACE__CONTROL_INTERNAL_H */