simpletrace: fix process() argument count
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Thu, 25 Aug 2011 17:03:49 +0000 (18:03 +0100)
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Thu, 1 Sep 2011 09:34:54 +0000 (10:34 +0100)
The simpletrace.process() function invokes analyzer methods with the
wrong number of arguments if a timestamp should be included.  This patch
fixes the issue so that trace analysis scripts can make use of
timestamps.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
scripts/simpletrace.py

index 2ad5699..f55e5e6 100755 (executable)
@@ -102,10 +102,10 @@ def process(events, log, analyzer):
         fn_argcount = len(inspect.getargspec(fn)[0]) - 1
         if fn_argcount == event_argcount + 1:
             # Include timestamp as first argument
-            return lambda _, rec: fn(*rec[1:2 + fn_argcount])
+            return lambda _, rec: fn(*rec[1:2 + event_argcount])
         else:
             # Just arguments, no timestamp
-            return lambda _, rec: fn(*rec[2:2 + fn_argcount])
+            return lambda _, rec: fn(*rec[2:2 + event_argcount])
 
     analyzer.begin()
     fn_cache = {}