x86: ich9: factor out "guest_cpu_hotplug_features"
[qemu/ar7.git] / trace / control-vcpu.h
blob0f98ebe7b5941239b7f5724ba053482981f0d65c
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_VCPU_H
11 #define TRACE__CONTROL_VCPU_H
13 #include "control.h"
14 #include "event-internal.h"
15 #include "hw/core/cpu.h"
17 /**
18 * trace_event_get_vcpu_state:
19 * @vcpu: Target vCPU.
20 * @id: Event identifier name.
22 * Get the tracing state of an event (both static and dynamic) for the given
23 * vCPU.
25 * If the event has the disabled property, the check will have no performance
26 * impact.
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))
33 /**
34 * trace_event_get_vcpu_state_dynamic:
36 * Get the dynamic tracing state of an event for the given vCPU.
38 static bool trace_event_get_vcpu_state_dynamic(CPUState *vcpu, TraceEvent *ev);
40 #include "control-internal.h"
42 static inline bool
43 trace_event_get_vcpu_state_dynamic_by_vcpu_id(CPUState *vcpu,
44 uint32_t vcpu_id)
46 /* it's on fast path, avoid consistency checks (asserts) */
47 if (unlikely(trace_events_enabled_count)) {
48 return test_bit(vcpu_id, vcpu->trace_dstate);
49 } else {
50 return false;
54 static inline bool trace_event_get_vcpu_state_dynamic(CPUState *vcpu,
55 TraceEvent *ev)
57 uint32_t vcpu_id;
58 assert(trace_event_is_vcpu(ev));
59 vcpu_id = trace_event_get_vcpu_id(ev);
60 return trace_event_get_vcpu_state_dynamic_by_vcpu_id(vcpu, vcpu_id);
63 #endif