Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / trace / control-target.c
blob97f21e476d2d7d7d77748669978fe4ca6aa00271
1 /*
2 * Interface for configuring and controlling the state of tracing events.
4 * Copyright (C) 2014-2017 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 #include "qemu/osdep.h"
11 #include "qemu/lockable.h"
12 #include "cpu.h"
13 #include "trace/trace-root.h"
14 #include "trace/control.h"
17 void trace_event_set_state_dynamic_init(TraceEvent *ev, bool state)
19 bool state_pre;
20 assert(trace_event_get_state_static(ev));
22 * We ignore the "vcpu" property here, since no vCPUs have been created
23 * yet. Then dstate can only be 1 or 0.
25 state_pre = *ev->dstate;
26 if (state_pre != state) {
27 if (state) {
28 trace_events_enabled_count++;
29 *ev->dstate = 1;
30 } else {
31 trace_events_enabled_count--;
32 *ev->dstate = 0;
37 void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
39 assert(trace_event_get_state_static(ev));
42 * There is no longer a "vcpu" property, dstate can only be 1 or
43 * 0. With it, we haven't instantiated any vCPU yet, so we will
44 * set a global state instead, and trace_init_vcpu will reconcile
45 * it afterwards.
47 bool state_pre = *ev->dstate;
48 if (state_pre != state) {
49 if (state) {
50 trace_events_enabled_count++;
51 *ev->dstate = 1;
52 } else {
53 trace_events_enabled_count--;
54 *ev->dstate = 0;