summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2016-10-04 14:35:45 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2016-10-12 09:35:54 +0200
commit93977402441405055500ff0389b49f6bbac9d50b (patch)
tree3a1e1ded1e54db71d2576460552faae5d0f32136 /scripts
parent599ab2f241ee6693ea0a2700210718327b346f7f (diff)
trace: remove global 'uint16 dstate[]' array
Instead of having a global dstate array, declare a single 'uint16 TRACE_${EVENT_NAME}_DSTATE' variable for each trace event. Record a pointer to this variable in the TraceEvent struct too. By turning trace_event_get_state_dynamic_by_id into a macro, this still hits the fast path, and cache affinity is ensured by declaring all the uint16 vars adjacent to each other. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: LluĂ­s Vilanova <vilanova@ac.upc.edu> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-7-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/tracetool/__init__.py3
-rw-r--r--scripts/tracetool/format/events_c.py9
-rw-r--r--scripts/tracetool/format/events_h.py3
3 files changed, 12 insertions, 3 deletions
diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index be24039c5e..a11f36b5d4 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -265,11 +265,12 @@ class Event(object):
QEMU_TRACE = "trace_%(name)s"
QEMU_TRACE_TCG = QEMU_TRACE + "_tcg"
+ QEMU_DSTATE = "_TRACE_%(NAME)s_DSTATE"
def api(self, fmt=None):
if fmt is None:
fmt = Event.QEMU_TRACE
- return fmt % {"name": self.name}
+ return fmt % {"name": self.name, "NAME": self.name.upper()}
def transform(self, *trans):
"""Return a new Event with transformed Arguments."""
diff --git a/scripts/tracetool/format/events_c.py b/scripts/tracetool/format/events_c.py
index 4012063283..ef873fa137 100644
--- a/scripts/tracetool/format/events_c.py
+++ b/scripts/tracetool/format/events_c.py
@@ -25,6 +25,9 @@ def generate(events, backend):
'#include "trace/control.h"',
'')
+ for e in events:
+ out('uint16_t %s;' % e.api(e.QEMU_DSTATE))
+
out('TraceEvent trace_events[TRACE_EVENT_COUNT] = {')
for e in events:
@@ -34,11 +37,13 @@ def generate(events, backend):
vcpu_id = "TRACE_VCPU_EVENT_COUNT"
out(' { .id = %(id)s, .vcpu_id = %(vcpu_id)s,'
' .name = \"%(name)s\",'
- ' .sstate = %(sstate)s },',
+ ' .sstate = %(sstate)s,',
+ ' .dstate = &%(dstate)s, }, ',
id = "TRACE_" + e.name.upper(),
vcpu_id = vcpu_id,
name = e.name,
- sstate = "TRACE_%s_ENABLED" % e.name.upper())
+ sstate = "TRACE_%s_ENABLED" % e.name.upper(),
+ dstate = e.api(e.QEMU_DSTATE))
out('};',
'')
diff --git a/scripts/tracetool/format/events_h.py b/scripts/tracetool/format/events_h.py
index a9da60b7fa..03417de0ec 100644
--- a/scripts/tracetool/format/events_h.py
+++ b/scripts/tracetool/format/events_h.py
@@ -32,6 +32,9 @@ def generate(events, backend):
out(' TRACE_EVENT_COUNT',
'} TraceEventID;')
+ for e in events:
+ out('extern uint16_t %s;' % e.api(e.QEMU_DSTATE))
+
# per-vCPU event identifiers
out('typedef enum {')