sim-card
/
qemu
Archived
10
0
Fork 0

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.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
This commit is contained in:
Stefan Hajnoczi 2011-08-25 18:03:49 +01:00
parent 47f08d7a9d
commit d8e8ef4ee0
1 changed files with 2 additions and 2 deletions

View File

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