]> git.proxmox.com Git - mirror_qemu.git/blob - trace/control-vcpu.h
trace: remove code that depends on setting vcpu
[mirror_qemu.git] / trace / control-vcpu.h
1 /*
2 * Interface for configuring and controlling the state of tracing events.
3 *
4 * Copyright (C) 2011-2016 LluĂ­s Vilanova <vilanova@ac.upc.edu>
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_VCPU_H
11 #define TRACE__CONTROL_VCPU_H
12
13 #include "control.h"
14 #include "event-internal.h"
15 #include "hw/core/cpu.h"
16
17 /**
18 * trace_event_get_vcpu_state:
19 * @vcpu: Target vCPU.
20 * @id: Event identifier name.
21 *
22 * Get the tracing state of an event (both static and dynamic) for the given
23 * vCPU.
24 *
25 * If the event has the disabled property, the check will have no performance
26 * impact.
27 */
28 #define trace_event_get_vcpu_state(vcpu, id) \
29 ((id ##_ENABLED) && \
30 trace_event_get_vcpu_state_dynamic_by_vcpu_id( \
31 vcpu, _ ## id ## _EVENT.vcpu_id))
32
33 #include "control-internal.h"
34
35 static inline bool
36 trace_event_get_vcpu_state_dynamic_by_vcpu_id(CPUState *vcpu,
37 uint32_t vcpu_id)
38 {
39 /* it's on fast path, avoid consistency checks (asserts) */
40 if (unlikely(trace_events_enabled_count)) {
41 return test_bit(vcpu_id, vcpu->trace_dstate);
42 } else {
43 return false;
44 }
45 }
46
47 #endif