summaryrefslogtreecommitdiff
path: root/trace
diff options
context:
space:
mode:
authorLluís Vilanova <vilanova@ac.upc.edu>2016-07-11 12:53:24 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2016-07-18 18:13:54 +0100
commit17f7ac75df3909c384c18274b41a2a91192599e3 (patch)
treeb5000f5a073806b11d4a5e4f73336df85f82d348 /trace
parent6913e79c3677a4282203fdd79af7927a94d0427e (diff)
downloadqemu-17f7ac75df3909c384c18274b41a2a91192599e3.tar.gz
qemu-17f7ac75df3909c384c18274b41a2a91192599e3.tar.bz2
qemu-17f7ac75df3909c384c18274b41a2a91192599e3.zip
trace: Identify events with the 'vcpu' property
A new event attribute 'cpu_id' is added to have a separate ID space ('TRACE_VCPU_*') for all events with the 'vcpu' property. These are later used to identify which events are enabled on each vCPU. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'trace')
-rw-r--r--trace/control-internal.h12
-rw-r--r--trace/control.h17
-rw-r--r--trace/event-internal.h4
3 files changed, 31 insertions, 2 deletions
diff --git a/trace/control-internal.h b/trace/control-internal.h
index deacc8f894..59bcbb4427 100644
--- a/trace/control-internal.h
+++ b/trace/control-internal.h
@@ -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.
@@ -38,6 +38,16 @@ static inline TraceEventID trace_event_get_id(TraceEvent *ev)
return ev->id;
}
+static inline TraceEventVCPUID trace_event_get_vcpu_id(TraceEvent *ev)
+{
+ return ev->vcpu_id;
+}
+
+static inline bool trace_event_is_vcpu(TraceEvent *ev)
+{
+ return ev->vcpu_id != TRACE_VCPU_EVENT_COUNT;
+}
+
static inline const char * trace_event_get_name(TraceEvent *ev)
{
assert(ev != NULL);
diff --git a/trace/control.h b/trace/control.h
index 452a800eb2..d7d6500438 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -86,6 +86,23 @@ static TraceEventID trace_event_count(void);
static TraceEventID trace_event_get_id(TraceEvent *ev);
/**
+ * trace_event_get_vcpu_id:
+ *
+ * Get the per-vCPU identifier of an event.
+ *
+ * Special value #TRACE_VCPU_EVENT_COUNT means the event is not vCPU-specific
+ * (does not have the "vcpu" property).
+ */
+static TraceEventVCPUID trace_event_get_vcpu_id(TraceEvent *ev);
+
+/**
+ * trace_event_is_vcpu:
+ *
+ * Whether this is a per-vCPU event.
+ */
+static bool trace_event_is_vcpu(TraceEvent *ev);
+
+/**
* trace_event_get_name:
*
* Get the name of an event.
diff --git a/trace/event-internal.h b/trace/event-internal.h
index e4ea2e78a9..5d8fa97ca5 100644
--- a/trace/event-internal.h
+++ b/trace/event-internal.h
@@ -1,7 +1,7 @@
/*
* Interface for configuring and controlling the state of tracing events.
*
- * Copyright (C) 2012 Lluís Vilanova <vilanova@ac.upc.edu>
+ * Copyright (C) 2012-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.
@@ -16,6 +16,7 @@
/**
* TraceEvent:
* @id: Unique event identifier.
+ * @vcpu_id: Unique per-vCPU event identifier.
* @name: Event name.
* @sstate: Static tracing state.
*
@@ -23,6 +24,7 @@
*/
typedef struct TraceEvent {
TraceEventID id;
+ TraceEventVCPUID vcpu_id;
const char * name;
const bool sstate;
} TraceEvent;