qemu-options: Mention locking option of file driver
[qemu/ar7.git] / trace / control-internal.h
bloba9d395a58705dbcd094c17e49436e88c1ecebccf
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 #include <stddef.h> /* size_t */
15 #include "qom/cpu.h"
18 extern int trace_events_enabled_count;
21 static inline bool trace_event_is_pattern(const char *str)
23 assert(str != NULL);
24 return strchr(str, '*') != NULL;
27 static inline uint32_t trace_event_get_id(TraceEvent *ev)
29 assert(ev != NULL);
30 return ev->id;
33 static inline uint32_t trace_event_get_vcpu_id(TraceEvent *ev)
35 return ev->vcpu_id;
38 static inline bool trace_event_is_vcpu(TraceEvent *ev)
40 return ev->vcpu_id != TRACE_VCPU_EVENT_NONE;
43 static inline const char * trace_event_get_name(TraceEvent *ev)
45 assert(ev != NULL);
46 return ev->name;
49 static inline bool trace_event_get_state_static(TraceEvent *ev)
51 assert(ev != NULL);
52 return ev->sstate;
55 /* it's on fast path, avoid consistency checks (asserts) */
56 #define trace_event_get_state_dynamic_by_id(id) \
57 (unlikely(trace_events_enabled_count) && _ ## id ## _DSTATE)
59 static inline bool trace_event_get_state_dynamic(TraceEvent *ev)
61 return unlikely(trace_events_enabled_count) && *ev->dstate;
64 static inline bool
65 trace_event_get_vcpu_state_dynamic_by_vcpu_id(CPUState *vcpu,
66 uint32_t vcpu_id)
68 /* it's on fast path, avoid consistency checks (asserts) */
69 if (unlikely(trace_events_enabled_count)) {
70 return test_bit(vcpu_id, vcpu->trace_dstate);
71 } else {
72 return false;
76 static inline bool trace_event_get_vcpu_state_dynamic(CPUState *vcpu,
77 TraceEvent *ev)
79 uint32_t vcpu_id;
80 assert(trace_event_is_vcpu(ev));
81 vcpu_id = trace_event_get_vcpu_id(ev);
82 return trace_event_get_vcpu_state_dynamic_by_vcpu_id(vcpu, vcpu_id);
86 void trace_event_register_group(TraceEvent **events);
88 #endif /* TRACE__CONTROL_INTERNAL_H */