From: José Fonseca Date: Tue, 7 Jun 2011 19:48:37 +0000 (+0100) Subject: tracediff: Allow to control the call limit. X-Git-Url: https://git.cworth.org/git?p=apitrace;a=commitdiff_plain;h=6599dac2e1b9762d7f4e2fa0bee930524f4b1452 tracediff: Allow to control the call limit. --- diff --git a/scripts/tracediff.py b/scripts/tracediff.py index 2506eb7..f588562 100755 --- a/scripts/tracediff.py +++ b/scripts/tracediff.py @@ -48,12 +48,12 @@ ignored_function_names = set([ ]) -def readtrace(trace): +def readtrace(trace, limit=sys.maxint): calls = [] parser = Parser() parser.open(trace) call = parser.parse_call() - while call and len(calls) < 1000: + while call and len(calls) < limit: hash(call) if call.sig.name not in ignored_function_names: calls.append(call) @@ -169,13 +169,17 @@ def main(): '-d', '--tracedump', metavar='PROGRAM', type='string', dest='tracedump', default='tracedump', help='tracedump command [default: %default]') + optparser.add_option( + '-l', '--limit', metavar='CALLS', + type='int', dest='limit', default=1000, + help='limit the number of calls [default: %default]') (options, args) = optparser.parse_args(sys.argv[1:]) if len(args) != 2: optparser.error("incorrect number of arguments") - ref_calls = readtrace(args[0]) - src_calls = readtrace(args[1]) + ref_calls = readtrace(args[0], options.limit) + src_calls = readtrace(args[1], options.limit) differ = SDiffer(ref_calls, src_calls) differ.diff()