]> git.proxmox.com Git - mirror_qemu.git/blame - trace/control-internal.h
Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-for-peter-2016-02...
[mirror_qemu.git] / trace / control-internal.h
CommitLineData
b1bae816
LV
1/*
2 * Interface for configuring and controlling the state of tracing events.
3 *
5b808275 4 * Copyright (C) 2011-2014 Lluís Vilanova <vilanova@ac.upc.edu>
b1bae816
LV
5 *
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 */
9
10#ifndef TRACE__CONTROL_INTERNAL_H
11#define TRACE__CONTROL_INTERNAL_H
12
13#include <string.h>
14
15
16extern TraceEvent trace_events[];
17
18
84f3fe1b 19static inline TraceEventID trace_event_count(void)
b1bae816 20{
84f3fe1b 21 return TRACE_EVENT_COUNT;
b1bae816
LV
22}
23
84f3fe1b 24static inline TraceEvent *trace_event_id(TraceEventID id)
b1bae816 25{
84f3fe1b
PM
26 assert(id < trace_event_count());
27 return &trace_events[id];
b1bae816
LV
28}
29
30static inline bool trace_event_is_pattern(const char *str)
31{
32 assert(str != NULL);
33 return strchr(str, '*') != NULL;
34}
35
36static inline TraceEventID trace_event_get_id(TraceEvent *ev)
37{
38 assert(ev != NULL);
39 return ev->id;
40}
41
42static inline const char * trace_event_get_name(TraceEvent *ev)
43{
44 assert(ev != NULL);
45 return ev->name;
46}
47
48static inline bool trace_event_get_state_static(TraceEvent *ev)
49{
50 assert(ev != NULL);
51 return ev->sstate;
52}
53
54static inline bool trace_event_get_state_dynamic(TraceEvent *ev)
55{
56 assert(ev != NULL);
57 return ev->dstate;
58}
59
60static inline void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
61{
62 assert(ev != NULL);
63 assert(trace_event_get_state_static(ev));
5b808275 64 ev->dstate = state;
b1bae816
LV
65}
66
67#endif /* TRACE__CONTROL_INTERNAL_H */