2 * Interface for configuring and controlling the state of tracing events.
4 * Copyright (C) 2014-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.
10 #include "qemu/osdep.h"
12 #include "trace/control.h"
13 #include "translate-all.h"
16 void trace_event_set_state_dynamic(TraceEvent
*ev
, bool state
)
19 assert(trace_event_get_state_static(ev
));
20 if (trace_event_is_vcpu(ev
)) {
22 trace_event_set_vcpu_state_dynamic(vcpu
, ev
, state
);
25 TraceEventID id
= trace_event_get_id(ev
);
26 trace_events_enabled_count
+= state
- trace_events_dstate
[id
];
27 trace_events_dstate
[id
] = state
;
31 void trace_event_set_vcpu_state_dynamic(CPUState
*vcpu
,
32 TraceEvent
*ev
, bool state
)
35 TraceEventVCPUID vcpu_id
;
37 assert(trace_event_get_state_static(ev
));
38 assert(trace_event_is_vcpu(ev
));
39 id
= trace_event_get_id(ev
);
40 vcpu_id
= trace_event_get_vcpu_id(ev
);
41 state_pre
= test_bit(vcpu_id
, vcpu
->trace_dstate
);
42 if (state_pre
!= state
) {
44 trace_events_enabled_count
++;
45 set_bit(vcpu_id
, vcpu
->trace_dstate
);
46 trace_events_dstate
[id
]++;
48 trace_events_enabled_count
--;
49 clear_bit(vcpu_id
, vcpu
->trace_dstate
);
50 trace_events_dstate
[id
]--;