Patchwork [v4,05/11] trace: [tracetool] Add support for event properties

login
register
mail settings
Submitter Lluís Vilanova
Date Feb. 10, 2012, 11:54 a.m.
Message ID <20120210115457.9787.1686.stgit@ginnungagap.bsc.es>
Download mbox | patch
Permalink /patch/140606/
State New
Headers show

Comments

Lluís Vilanova - Feb. 10, 2012, 11:54 a.m.
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 scripts/tracetool.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

Patch

diff --git a/scripts/tracetool.py b/scripts/tracetool.py
index 07563f0..f369579 100755
--- a/scripts/tracetool.py
+++ b/scripts/tracetool.py
@@ -472,7 +472,9 @@  trace_gen = {
 
 # A trace event
 import re
-cre = re.compile("(?P<name>[^(\s]+)\((?P<args>[^)]*)\)\s*(?P<fmt>\".*)?")
+cre = re.compile("((?P<props>.*)\s+)?(?P<name>[^(\s]+)\((?P<args>[^)]*)\)\s*(?P<fmt>\".*)?")
+
+VALID_PROPS = set(["disable"])
 
 class Event(object):
     def __init__(self, line):
@@ -489,6 +491,10 @@  class Event(object):
         self.argnames = get_argnames(self.args)
         self.sizestr = calc_sizeofargs(self.args, self.argc)
         self.fmt = groups["fmt"]
+        self.properties = groups["props"].split()
+        unknown_props = set(self.properties) - VALID_PROPS
+        if len(unknown_props) > 0:
+            raise ValueError("Unknown properties: %s" % ", ".join(unknown_props))
 
 # Generator that yields Event objects given a trace-events file object
 def read_events(fobj):