diff options
author | Greg Clayton <gclayton@apple.com> | 2012-03-23 00:01:02 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-03-23 00:01:02 +0000 |
commit | 18eca8a0bdca2e1c7c3c3f52ea01e33031fd0ed6 (patch) | |
tree | 4de241eb1d20c8aec46ecac6d989ae0a7dedda1c /lldb/examples/python/delta.py | |
parent | e005070ccf8d3e4008543ae63bd5b69744ec7fa1 (diff) | |
download | bcm5719-llvm-18eca8a0bdca2e1c7c3c3f52ea01e33031fd0ed6.tar.gz bcm5719-llvm-18eca8a0bdca2e1c7c3c3f52ea01e33031fd0ed6.zip |
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.
llvm-svn: 153294
Diffstat (limited to 'lldb/examples/python/delta.py')
-rwxr-xr-x | lldb/examples/python/delta.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lldb/examples/python/delta.py b/lldb/examples/python/delta.py index b6a25374966..da17dd7ec49 100755 --- a/lldb/examples/python/delta.py +++ b/lldb/examples/python/delta.py @@ -49,6 +49,9 @@ def parse_time_log(debugger, command, result, dict): # 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 @@ def parse_log_file(file, options): 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 @@ def parse_log_file(file, options): 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 |