Patchwork [v7,07/11] trace: [tracetool] Process the "disable" event property

login
register
mail settings
Submitter Lluís Vilanova
Date March 21, 2012, 9:53 p.m.
Message ID <20120321215306.3272.87352.stgit@ginnungagap.bsc.es>
Download mbox | patch
Permalink /patch/148080/
State New
Headers show

Comments

Lluís Vilanova - March 21, 2012, 9:53 p.m.
Use different converters (depending on the 'disabled' property) regardless of
the output format.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
---
 scripts/tracetool.py |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

Patch

diff --git a/scripts/tracetool.py b/scripts/tracetool.py
index 27d1db4..71e2979 100755
--- a/scripts/tracetool.py
+++ b/scripts/tracetool.py
@@ -288,6 +288,9 @@  def dtrace_d(events):
     print
     print '};'
 
+def dtrace_nop_d(events):
+    pass
+
 def dtrace_stp(events):
     for event in events:
         # Define prototype for probe arguments
@@ -309,6 +312,9 @@  probe %(probeprefix)s.%(name)s = process("%(binary)s").mark("%(name)s")
         print '}'
     print
 
+def dtrace_nop_stp(events):
+    pass
+
 def trace_stap_begin():
     print '/* This file is autogenerated by tracetool, do not edit. */'
 
@@ -332,6 +338,8 @@  converters = {
     'nop': {
         'h': nop_h,
         'c': nop_c,
+        'd': dtrace_nop_d,
+        'stap': dtrace_nop_stp,
     },
 
     'stderr': {
@@ -482,17 +490,11 @@  def main():
         if probeprefix == "":
             probeprefix = 'qemu.' + targettype + '.' + targetarch
 
-    disabled_events, enabled_events = [], []
-    for e in read_events(sys.stdin):
-        if 'disable' in e.properties:
-            disabled_events.append(e)
-        else:
-            enabled_events.append(e)
+    events = read_events(sys.stdin)
 
     trace_gen[output]['begin']()
-    if output == 'h': # disabled events
-        converters['nop'][output](disabled_events)
-    converters[backend][output](enabled_events)
+    converters[backend][output]([ e for e in events if 'disable' not in e.properties ])
+    converters['nop'][output]([ e for e in events if 'disable' in e.properties ])
     trace_gen[output]['end']()
 
 if __name__ == "__main__":