From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYxRQ-00089f-G9 for qemu-devel@nongnu.org; Thu, 25 Feb 2016 10:03:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aYxRK-0008Ok-Rs for qemu-devel@nongnu.org; Thu, 25 Feb 2016 10:02:56 -0500 Received: from roura.ac.upc.edu ([147.83.33.10]:37952 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYxRK-0008Ob-FK for qemu-devel@nongnu.org; Thu, 25 Feb 2016 10:02:50 -0500 From: =?utf-8?b?TGx1w61z?= Vilanova Date: Thu, 25 Feb 2016 16:02:49 +0100 Message-Id: <145641256916.30097.9809274374464522532.stgit@localhost> In-Reply-To: <145641255678.30097.2919142707547689749.stgit@localhost> References: <145641255678.30097.2919142707547689749.stgit@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 1/6] trace: Identify events with the 'vcpu' property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Stefan Hajnoczi 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=C3=ADs Vilanova --- 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/for= mat/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 """ =20 __author__ =3D "Llu=C3=ADs Vilanova " -__copyright__ =3D "Copyright 2012-2014, Llu=C3=ADs Vilanova " +__copyright__ =3D "Copyright 2012-2016, Llu=C3=ADs Vilanova " __license__ =3D "GPL version 2 or (at your option) any later version" =20 __maintainer__ =3D "Stefan Hajnoczi" @@ -28,8 +28,15 @@ def generate(events, backend): out('TraceEvent trace_events[TRACE_EVENT_COUNT] =3D {') =20 for e in events: - out(' { .id =3D %(id)s, .name =3D \"%(name)s\", .sstate =3D %= (sstate)s },', + if "vcpu" in e.properties: + vcpu_id =3D "TRACE_VCPU_" + e.name.upper() + else: + vcpu_id =3D "TRACE_VCPU_EVENT_COUNT" + out(' { .id =3D %(id)s, .cpu_id =3D %(vcpu_id)s,' + ' .name =3D \"%(name)s\",' + ' .sstate =3D %(sstate)s },', id =3D "TRACE_" + e.name.upper(), + vcpu_id =3D vcpu_id, name =3D e.name, sstate =3D "TRACE_%s_ENABLED" % e.name.upper()) =20 diff --git a/scripts/tracetool/format/events_h.py b/scripts/tracetool/for= mat/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;') =20 + # 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 =3D 0 else: enabled =3D 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=3De.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=C3=ADs Vilanova + * Copyright (C) 2011-2016 Llu=C3=ADs Vilanova * * This work is licensed under the terms of the GNU GPL, version 2 or la= ter. * See the COPYING file in the top-level directory. @@ -40,6 +40,12 @@ static inline TraceEventID trace_event_get_id(TraceEve= nt *ev) return ev->id; } =20 +static inline TraceEventVCPUID trace_event_get_cpu_id(TraceEvent *ev) +{ + assert(ev !=3D NULL); + return ev->cpu_id; +} + static inline const char * trace_event_get_name(TraceEvent *ev) { assert(ev !=3D 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); =20 /** + * 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-spe= cific + * (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=C3=ADs Vilanova + * Copyright (C) 2012-2016 Llu=C3=ADs Vilanova * * This work is licensed under the terms of the GNU GPL, version 2 or la= ter. * 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;