Fixed up the command so that it doesn't dump the first arguments when run from the command line which was causing this script to dump the script itself.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153294 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/examples/python/delta.py b/examples/python/delta.py
index b6a2537..da17dd7 100755
--- a/examples/python/delta.py
+++ b/examples/python/delta.py
@@ -49,6 +49,9 @@
# Any commands whose names might be followed by more valid C identifier
# characters must be listed here
command_args = shlex.split(command)
+ parse_time_log_args (command_args)
+
+def parse_time_log_args(command_args):
usage = "usage: parse_time_log [options] [<LOGFILEPATH>]"
description='''Parse a log file that contains timestamps and convert the timestamps to delta times between log lines.'''
parser = optparse.OptionParser(description=description, prog='parse_time_log',usage=usage)
@@ -72,6 +75,10 @@
handy when trying to figure out why some operation in the debugger is taking
a long time during a preset set of debugger commands.'''
+ print '#----------------------------------------------------------------------'
+ print "# Log file: '%s'" % file
+ print '#----------------------------------------------------------------------'
+
timestamp_regex = re.compile('(\s*)([1-9][0-9]+\.[0-9]+)([^0-9].*)$')
base_time = 0.0
@@ -97,13 +104,7 @@
if __name__ == '__main__':
import sys
- # This script is being run from the command line, create a debugger in case we are
- # going to use any debugger functions in our function.
- for file in sys.argv:
- print '#----------------------------------------------------------------------'
- print "# Log file: '%s'" % file
- print '#----------------------------------------------------------------------'
- parse_log_file (file, None)
+ parse_time_log_args (sys.argv[1:])
else:
import lldb