qemu
1/*
2* Interface for configuring and controlling the state of tracing events.
3*
4* Copyright (C) 2014-2017 Lluís Vilanova <vilanova@ac.upc.edu>
5*
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*/
9
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"15
16
17void trace_event_set_state_dynamic_init(TraceEvent *ev, bool state)18{
19bool state_pre;20assert(trace_event_get_state_static(ev));21/*22* We ignore the "vcpu" property here, since no vCPUs have been created
23* yet. Then dstate can only be 1 or 0.
24*/
25state_pre = *ev->dstate;26if (state_pre != state) {27if (state) {28trace_events_enabled_count++;29*ev->dstate = 1;30} else {31trace_events_enabled_count--;32*ev->dstate = 0;33}34}35}
36
37void trace_event_set_state_dynamic(TraceEvent *ev, bool state)38{
39assert(trace_event_get_state_static(ev));40
41/*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.
46*/
47bool state_pre = *ev->dstate;48if (state_pre != state) {49if (state) {50trace_events_enabled_count++;51*ev->dstate = 1;52} else {53trace_events_enabled_count--;54*ev->dstate = 0;55}56}57}
58