aboutsummaryrefslogtreecommitdiff
path: root/trace/control.c
diff options
context:
space:
mode:
authorLluís Vilanova <vilanova@ac.upc.edu>2016-07-11 12:53:41 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2016-07-18 18:23:12 +0100
commit4815185902971c41fcdd700fa1fc3e1d9299900f (patch)
treefcdcdbb543e1ea9828e4e8820368675692f761f3 /trace/control.c
parente1d6e0a4c0e23b30501b887211f1fa6e0eb799a3 (diff)
trace: Add per-vCPU tracing states for events with the 'vcpu' property
Each vCPU gets a 'trace_dstate' bitmap to control the per-vCPU dynamic tracing state of events with the 'vcpu' property. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'trace/control.c')
-rw-r--r--trace/control.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/trace/control.c b/trace/control.c
index 86de8b9983..d173c09f44 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -1,7 +1,7 @@
/*
* Interface for configuring and controlling the state of tracing events.
*
- * Copyright (C) 2011-2014 Lluís Vilanova <vilanova@ac.upc.edu>
+ * Copyright (C) 2011-2016 Lluís Vilanova <vilanova@ac.upc.edu>
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
@@ -25,7 +25,14 @@
#include "monitor/monitor.h"
int trace_events_enabled_count;
-bool trace_events_dstate[TRACE_EVENT_COUNT];
+/*
+ * Interpretation depends on wether the event has the 'vcpu' property:
+ * - false: Boolean value indicating whether the event is active.
+ * - true : Integral counting the number of vCPUs that have this event enabled.
+ */
+uint16_t trace_events_dstate[TRACE_EVENT_COUNT];
+/* Marks events for late vCPU state init */
+static bool trace_events_dstate_init[TRACE_EVENT_COUNT];
QemuOptsList qemu_trace_opts = {
.name = "trace",
@@ -135,7 +142,10 @@ static void do_trace_enable_events(const char *line_buf)
TraceEvent *ev = NULL;
while ((ev = trace_event_pattern(line_ptr, ev)) != NULL) {
if (trace_event_get_state_static(ev)) {
+ /* start tracing */
trace_event_set_state_dynamic(ev, enable);
+ /* mark for late vCPU init */
+ trace_events_dstate_init[ev->id] = true;
}
}
} else {
@@ -147,7 +157,10 @@ static void do_trace_enable_events(const char *line_buf)
error_report("WARNING: trace event '%s' is not traceable",
line_ptr);
} else {
+ /* start tracing */
trace_event_set_state_dynamic(ev, enable);
+ /* mark for late vCPU init */
+ trace_events_dstate_init[ev->id] = true;
}
}
}
@@ -257,3 +270,15 @@ char *trace_opt_parse(const char *optarg)
return trace_file;
}
+
+void trace_init_vcpu_events(void)
+{
+ TraceEvent *ev = NULL;
+ while ((ev = trace_event_pattern("*", ev)) != NULL) {
+ if (trace_event_is_vcpu(ev) &&
+ trace_event_get_state_static(ev) &&
+ trace_events_dstate_init[ev->id]) {
+ trace_event_set_state_dynamic(ev, true);
+ }
+ }
+}