Skip to contentSkip to conversation

simpletrace: fix process() argument count

PATCH New Stefan Hajnoczi 1 participant 1 message Aug 31, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 simpletrace: fix process() argument count

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.

---
 scripts/simpletrace.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
scripts/simpletrace.py +2 -2
index 2ad5699..f55e5e6 100755
@@ -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 = {}
Signature · 1 line
1.7.5.4