@@ -144,7 +144,12 @@ class Event(object):
unknown_props = set(self.properties) - self._VALID_PROPS
if len(unknown_props) > 0:
- raise ValueError("Unknown properties: %s" % ", ".join(unknown_props))
+ raise ValueError("Unknown properties: %s" %
+ ", ".join(unknown_props))
+
+ def copy(other):
+ return Event(other.name, list(other.properties), other.fmt, other.args,
+ other)
@staticmethod
def build(line_str):
@@ -197,7 +202,7 @@ class TracetoolError (Exception):
pass
-def try_import(mod_name, attr_name = None, attr_default = None):
+def try_import(mod_name, attr_name=None, attr_default=None):
"""Try to import a module and get an attribute from it.
Parameters
@@ -224,7 +229,7 @@ def try_import(mod_name, attr_name = None, attr_default = None):
def generate(fevents, format, backend,
- binary = None, probe_prefix = None):
+ binary=None, probe_prefix=None):
"""Generate the output for the given (format, backend) pair.
Parameters
@@ -246,18 +251,18 @@ def generate(fevents, format, backend,
format = str(format)
if len(format) is 0:
raise TracetoolError("format not set")
- mformat = format.replace("-", "_")
- if not tracetool.format.exists(mformat):
+ if not tracetool.format.exists(format):
raise TracetoolError("unknown format: %s" % format)
+ format = format.replace("-", "_")
backend = str(backend)
if len(backend) is 0:
raise TracetoolError("backend not set")
- mbackend = backend.replace("-", "_")
- if not tracetool.backend.exists(mbackend):
+ if not tracetool.backend.exists(backend):
raise TracetoolError("unknown backend: %s" % backend)
+ backend = backend.replace("-", "_")
- if not tracetool.backend.compatible(mbackend, mformat):
+ if not tracetool.backend.compatible(backend, format):
raise TracetoolError("backend '%s' not compatible with format '%s'" %
(backend, format))
@@ -270,7 +275,7 @@ def generate(fevents, format, backend,
if backend == "nop":
( e.properies.add("disable") for e in events )
- tracetool.format.generate_begin(mformat, events)
+ tracetool.format.generate_begin(format, events)
tracetool.backend.generate("nop", format,
[ e
for e in events
@@ -279,4 +284,4 @@ def generate(fevents, format, backend,
[ e
for e in events
if "disable" not in e.properties ])
- tracetool.format.generate_end(mformat, events)
+ tracetool.format.generate_end(format, events)
@@ -59,7 +59,7 @@ def get_list(only_public = False):
for filename in os.listdir(tracetool.backend.__path__[0]):
if filename.endswith('.py') and filename != '__init__.py':
modnames.append(filename.rsplit('.', 1)[0])
- for modname in modnames:
+ for modname in sorted(modnames):
module = tracetool.try_import("tracetool.backend." + modname)
# just in case; should never fail unless non-module files are put there
@@ -53,7 +53,7 @@ def get_list():
for filename in os.listdir(tracetool.format.__path__[0]):
if filename.endswith('.py') and filename != '__init__.py':
modnames.append(filename.rsplit('.', 1)[0])
- for modname in modnames:
+ for modname in sorted(modnames):
module = tracetool.try_import("tracetool.format." + modname)
# just in case; should never fail unless non-module files are put there
@@ -2,11 +2,11 @@
# -*- coding: utf-8 -*-
"""
-Generate .c file.
+trace/generated-tracers.c
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi"
@@ -2,11 +2,11 @@
# -*- coding: utf-8 -*-
"""
-Generate .d file (DTrace only).
+trace/generated-tracers.dtrace (DTrace only).
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi"
@@ -2,11 +2,11 @@
# -*- coding: utf-8 -*-
"""
-Generate .c for event description.
+trace/generated-events.c
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi"
@@ -2,11 +2,11 @@
# -*- coding: utf-8 -*-
"""
-Generate .h for event description.
+trace/generated-events.h
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi"
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
"""
-Generate .h file.
+trace/generated-tracers.h
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> --- scripts/tracetool/__init__.py | 25 +++++++++++++++---------- scripts/tracetool/backend/__init__.py | 2 +- scripts/tracetool/format/__init__.py | 2 +- scripts/tracetool/format/c.py | 4 ++-- scripts/tracetool/format/d.py | 4 ++-- scripts/tracetool/format/events_c.py | 4 ++-- scripts/tracetool/format/events_h.py | 4 ++-- scripts/tracetool/format/h.py | 2 +- 8 files changed, 26 insertions(+), 21 deletions(-)