From: "Lluís Vilanova" <vilanova@ac.upc.edu>
To: qemu-devel@nongnu.org
Cc: Eduardo Habkost <ehabkost@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 1/6] trace: Identify events with the 'vcpu' property
Date: Thu, 25 Feb 2016 16:02:49 +0100 [thread overview]
Message-ID: <145641256916.30097.9809274374464522532.stgit@localhost> (raw)
In-Reply-To: <145641255678.30097.2919142707547689749.stgit@localhost>
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>
---
scripts/tracetool/format/events_c.py | 11 +++++++++--
scripts/tracetool/format/events_h.py | 12 +++++++++++-
trace/control-internal.h | 8 +++++++-
trace/control.h | 10 ++++++++++
trace/event-internal.h | 4 +++-
5 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/scripts/tracetool/format/events_c.py b/scripts/tracetool/format/events_c.py
index 1cc6a49..acfe254 100644
--- a/scripts/tracetool/format/events_c.py
+++ b/scripts/tracetool/format/events_c.py
@@ -6,7 +6,7 @@ trace/generated-events.c
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__ = "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi"
@@ -28,8 +28,15 @@ def generate(events, backend):
out('TraceEvent trace_events[TRACE_EVENT_COUNT] = {')
for e in events:
- out(' { .id = %(id)s, .name = \"%(name)s\", .sstate = %(sstate)s },',
+ if "vcpu" in e.properties:
+ vcpu_id = "TRACE_VCPU_" + e.name.upper()
+ else:
+ vcpu_id = "TRACE_VCPU_EVENT_COUNT"
+ out(' { .id = %(id)s, .cpu_id = %(vcpu_id)s,'
+ ' .name = \"%(name)s\",'
+ ' .sstate = %(sstate)s },',
id = "TRACE_" + e.name.upper(),
+ vcpu_id = vcpu_id,
name = e.name,
sstate = "TRACE_%s_ENABLED" % e.name.upper())
diff --git a/scripts/tracetool/format/events_h.py b/scripts/tracetool/format/events_h.py
index bbfaa5b..e7874e8 100644
--- a/scripts/tracetool/format/events_h.py
+++ b/scripts/tracetool/format/events_h.py
@@ -34,13 +34,23 @@ def generate(events, backend):
out(' TRACE_EVENT_COUNT',
'} TraceEventID;')
+ # per-vCPU event identifiers
+ out('typedef enum {')
+
+ for e in events:
+ if "vcpu" in e.properties:
+ out(' TRACE_VCPU_%s,' % e.name.upper())
+
+ out(' TRACE_VCPU_EVENT_COUNT',
+ '} TraceEventVCPUID;')
+
# static state
for e in events:
if 'disable' in e.properties:
enabled = 0
else:
enabled = 1
- if "tcg-trans" in e.properties:
+ if "tcg-exec" in e.properties:
# a single define for the two "sub-events"
out('#define TRACE_%(name)s_ENABLED %(enabled)d',
name=e.original.name.upper(),
diff --git a/trace/control-internal.h b/trace/control-internal.h
index dcf67f5..c78a45a 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.
@@ -40,6 +40,12 @@ static inline TraceEventID trace_event_get_id(TraceEvent *ev)
return ev->id;
}
+static inline TraceEventVCPUID trace_event_get_cpu_id(TraceEvent *ev)
+{
+ assert(ev != NULL);
+ return ev->cpu_id;
+}
+
static inline const char * trace_event_get_name(TraceEvent *ev)
{
assert(ev != NULL);
diff --git a/trace/control.h b/trace/control.h
index f0fe535..f014e11 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -87,6 +87,16 @@ static TraceEventID trace_event_count(void);
static TraceEventID trace_event_get_id(TraceEvent *ev);
/**
+ * trace_event_get_cpu_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_cpu_id(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 86f6a51..e5ff55f 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.
+ * @cpu_id: Unique per-vCPU event identifier.
* @name: Event name.
* @sstate: Static tracing state.
*
@@ -23,6 +24,7 @@
*/
typedef struct TraceEvent {
TraceEventID id;
+ TraceEventVCPUID cpu_id;
const char * name;
const bool sstate;
} TraceEvent;
next prev parent reply other threads:[~2016-02-25 15:03 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-25 15:02 [Qemu-devel] [PATCH0/6] trace: Per-vCPU tracing states Lluís Vilanova
2016-02-25 15:02 ` Lluís Vilanova [this message]
2016-06-09 12:11 ` [Qemu-devel] [PATCH 1/6] trace: Identify events with the 'vcpu' property Stefan Hajnoczi
2016-02-25 15:02 ` [Qemu-devel] [PATCH 2/6] disas: Remove unused macro '_' Lluís Vilanova
2016-06-09 8:18 ` Stefan Hajnoczi
2016-06-09 10:34 ` Lluís Vilanova
2016-02-25 15:03 ` [Qemu-devel] [PATCH 3/6] [trivial] trace: Cosmetic changes on fast-path tracing Lluís Vilanova
2016-06-09 12:11 ` Stefan Hajnoczi
2016-06-13 9:04 ` Paolo Bonzini
2016-06-13 13:39 ` Lluís Vilanova
2016-02-25 15:03 ` [Qemu-devel] [PATCH 4/6] trace: Add per-vCPU tracing states for events with the 'vcpu' property Lluís Vilanova
2016-06-09 12:07 ` Stefan Hajnoczi
2016-06-09 14:17 ` Lluís Vilanova
2016-06-10 16:25 ` Stefan Hajnoczi
2016-06-10 17:52 ` Lluís Vilanova
2016-06-13 8:38 ` Paolo Bonzini
2016-06-13 12:17 ` Lluís Vilanova
2016-06-13 9:13 ` Paolo Bonzini
2016-06-13 12:15 ` Lluís Vilanova
2016-06-13 14:08 ` Paolo Bonzini
2016-06-13 16:39 ` Lluís Vilanova
2016-06-14 8:39 ` Stefan Hajnoczi
2016-06-14 9:13 ` Paolo Bonzini
2016-06-14 12:17 ` Lluís Vilanova
2016-06-13 14:38 ` Lluís Vilanova
2016-02-25 15:03 ` [Qemu-devel] [PATCH 5/6] trace: Conditionally trace events based on their per-vCPU state Lluís Vilanova
2016-06-09 12:09 ` Stefan Hajnoczi
2016-02-25 15:03 ` [Qemu-devel] [PATCH 6/6] trace: Add QAPI/QMP interfaces to query and control per-vCPU tracing state Lluís Vilanova
2016-06-09 12:10 ` Stefan Hajnoczi
2016-03-07 19:35 ` [Qemu-devel] [PATCH0/6] trace: Per-vCPU tracing states Lluís Vilanova
2016-06-01 12:14 ` Lluís Vilanova
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=145641256916.30097.9809274374464522532.stgit@localhost \
--to=vilanova@ac.upc.edu \
--cc=ehabkost@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).