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 { 218eb1b9dbSLluís Vilanova bool state_pre; 2248151859SLluís Vilanova assert(trace_event_get_state_static(ev)); 23*93977402SDaniel P. Berrange 248eb1b9dbSLluís Vilanova /* 258eb1b9dbSLluís Vilanova * We ignore the "vcpu" property here, since there's no target code. Then 268eb1b9dbSLluís Vilanova * dstate can only be 1 or 0. 278eb1b9dbSLluís Vilanova */ 28*93977402SDaniel P. Berrange state_pre = *(ev->dstate); 298eb1b9dbSLluís Vilanova if (state_pre != state) { 308eb1b9dbSLluís Vilanova if (state) { 318eb1b9dbSLluís Vilanova trace_events_enabled_count++; 32*93977402SDaniel P. Berrange *(ev->dstate) = 1; 338eb1b9dbSLluís Vilanova } else { 348eb1b9dbSLluís Vilanova trace_events_enabled_count--; 35*93977402SDaniel P. Berrange *(ev->dstate) = 0; 368eb1b9dbSLluís Vilanova } 378eb1b9dbSLluís Vilanova } 3848151859SLluís Vilanova } 3948151859SLluís Vilanova 4048151859SLluís Vilanova void trace_event_set_vcpu_state_dynamic(CPUState *vcpu, 4148151859SLluís Vilanova TraceEvent *ev, bool state) 4248151859SLluís Vilanova { 4348151859SLluís Vilanova /* should never be called on non-target binaries */ 4448151859SLluís Vilanova abort(); 4548151859SLluís Vilanova } 462bfe11c8SLluís Vilanova 472bfe11c8SLluís Vilanova void trace_init_vcpu(CPUState *vcpu) 482bfe11c8SLluís Vilanova { 492bfe11c8SLluís Vilanova /* should never be called on non-target binaries */ 502bfe11c8SLluís Vilanova abort(); 512bfe11c8SLluís Vilanova } 52