xref: /openbmc/qemu/stubs/trace-control.c (revision 2bfe11c8fac96db4f94abbe818fbc964a6744130)
148151859SLluís Vilanova /*
248151859SLluís Vilanova  * Interface for configuring and controlling the state of tracing events.
348151859SLluís Vilanova  *
448151859SLluís Vilanova  * Copyright (C) 2014-2016 Lluís Vilanova <vilanova@ac.upc.edu>
548151859SLluís Vilanova  *
648151859SLluís Vilanova  * This work is licensed under the terms of the GNU GPL, version 2 or later.
748151859SLluís Vilanova  * See the COPYING file in the top-level directory.
848151859SLluís Vilanova  */
948151859SLluís Vilanova 
1048151859SLluís Vilanova #include "qemu/osdep.h"
1148151859SLluís Vilanova #include "trace/control.h"
1248151859SLluís Vilanova 
1348151859SLluís Vilanova 
14a4d50b1dSLluís Vilanova void trace_event_set_state_dynamic_init(TraceEvent *ev, bool state)
15a4d50b1dSLluís Vilanova {
16a4d50b1dSLluís Vilanova     trace_event_set_state_dynamic(ev, state);
17a4d50b1dSLluís Vilanova }
18a4d50b1dSLluís Vilanova 
1948151859SLluís Vilanova void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
2048151859SLluís Vilanova {
2148151859SLluís Vilanova     TraceEventID id;
228eb1b9dbSLluís Vilanova     bool state_pre;
2348151859SLluís Vilanova     assert(trace_event_get_state_static(ev));
2448151859SLluís Vilanova     id = trace_event_get_id(ev);
258eb1b9dbSLluís Vilanova     /*
268eb1b9dbSLluís Vilanova      * We ignore the "vcpu" property here, since there's no target code. Then
278eb1b9dbSLluís Vilanova      * dstate can only be 1 or 0.
288eb1b9dbSLluís Vilanova      */
298eb1b9dbSLluís Vilanova     state_pre = trace_events_dstate[id];
308eb1b9dbSLluís Vilanova     if (state_pre != state) {
318eb1b9dbSLluís Vilanova         if (state) {
328eb1b9dbSLluís Vilanova             trace_events_enabled_count++;
338eb1b9dbSLluís Vilanova             trace_events_dstate[id] = 1;
348eb1b9dbSLluís Vilanova         } else {
358eb1b9dbSLluís Vilanova             trace_events_enabled_count--;
368eb1b9dbSLluís Vilanova             trace_events_dstate[id] = 0;
378eb1b9dbSLluís Vilanova         }
388eb1b9dbSLluís Vilanova     }
3948151859SLluís Vilanova }
4048151859SLluís Vilanova 
4148151859SLluís Vilanova void trace_event_set_vcpu_state_dynamic(CPUState *vcpu,
4248151859SLluís Vilanova                                         TraceEvent *ev, bool state)
4348151859SLluís Vilanova {
4448151859SLluís Vilanova     /* should never be called on non-target binaries */
4548151859SLluís Vilanova     abort();
4648151859SLluís Vilanova }
47*2bfe11c8SLluís Vilanova 
48*2bfe11c8SLluís Vilanova void trace_init_vcpu(CPUState *vcpu)
49*2bfe11c8SLluís Vilanova {
50*2bfe11c8SLluís Vilanova     /* should never be called on non-target binaries */
51*2bfe11c8SLluís Vilanova     abort();
52*2bfe11c8SLluís Vilanova }
53