2011-10-22 08:57:05 +08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
"""
|
|
|
|
A simple bench runner which delegates to the ./dotest.py test driver to run the
|
|
|
|
benchmarks defined in the list named 'benches'.
|
|
|
|
|
|
|
|
You need to hand edit 'benches' to modify/change the command lines passed to the
|
|
|
|
test driver.
|
|
|
|
|
|
|
|
Use the following to get only the benchmark results in your terminal output:
|
|
|
|
|
2011-10-27 06:58:02 +08:00
|
|
|
./bench.py -e /Volumes/data/lldb/svn/regression/build/Debug/lldb -x '-F Driver::MainLoop()' 2>&1 | grep -P '^lldb.*benchmark:'
|
|
|
|
|
|
|
|
See also bench-history.
|
2011-10-22 08:57:05 +08:00
|
|
|
"""
|
|
|
|
|
|
|
|
import os, sys
|
|
|
|
import re
|
2011-10-27 06:58:02 +08:00
|
|
|
from optparse import OptionParser
|
2011-10-22 08:57:05 +08:00
|
|
|
|
|
|
|
# dotest.py invocation with no '-e exe-path' uses lldb as the inferior program,
|
|
|
|
# unless there is a mentioning of custom executable program.
|
|
|
|
benches = [
|
2011-10-27 06:58:02 +08:00
|
|
|
# Measure startup delays creating a target, setting a breakpoint, and run to breakpoint stop.
|
|
|
|
'./dotest.py -v +b %E %X -n -p TestStartupDelays.py',
|
2011-10-22 08:57:05 +08:00
|
|
|
|
2011-10-27 06:58:02 +08:00
|
|
|
# Measure 'frame variable' response after stopping at a breakpoint.
|
|
|
|
'./dotest.py -v +b %E %X -n -p TestFrameVariableResponse.py',
|
2011-10-22 08:57:05 +08:00
|
|
|
|
2011-10-27 06:58:02 +08:00
|
|
|
# Measure stepping speed after stopping at a breakpoint.
|
|
|
|
'./dotest.py -v +b %E %X -n -p TestSteppingSpeed.py',
|
2011-10-22 08:57:05 +08:00
|
|
|
|
|
|
|
# Measure expression cmd response with a simple custom executable program.
|
|
|
|
'./dotest.py +b -n -p TestExpressionCmd.py',
|
|
|
|
|
2011-10-27 06:58:02 +08:00
|
|
|
# Attach to a spawned process then run disassembly benchmarks.
|
|
|
|
'./dotest.py -v +b -n %E -p TestDoAttachThenDisassembly.py'
|
2011-10-22 08:57:05 +08:00
|
|
|
]
|
|
|
|
|
|
|
|
def main():
|
|
|
|
"""Read the items from 'benches' and run the command line one by one."""
|
2011-10-27 06:58:02 +08:00
|
|
|
parser = OptionParser(usage="""\
|
|
|
|
%prog [options]
|
|
|
|
Run the standard benchmarks defined in the list named 'benches'.\
|
|
|
|
""")
|
|
|
|
parser.add_option('-e', '--executable',
|
|
|
|
type='string', action='store',
|
|
|
|
dest='exe',
|
|
|
|
help='The target program launched by lldb.')
|
|
|
|
parser.add_option('-x', '--breakpoint-spec',
|
|
|
|
type='string', action='store',
|
|
|
|
dest='break_spec',
|
|
|
|
help='The lldb breakpoint spec for the target program.')
|
|
|
|
|
|
|
|
# Parses the options, if any.
|
|
|
|
opts, args = parser.parse_args()
|
|
|
|
|
2011-10-22 08:57:05 +08:00
|
|
|
print "Starting bench runner...."
|
|
|
|
|
2011-10-27 06:58:02 +08:00
|
|
|
for item in benches:
|
|
|
|
command = item.replace('%E',
|
|
|
|
'-e "%s"' % opts.exe if opts.exe else '')
|
|
|
|
command = command.replace('%X',
|
|
|
|
'-x "%s"' % opts.break_spec if opts.break_spec else '')
|
2011-10-22 08:57:05 +08:00
|
|
|
print "Running %s" % (command)
|
|
|
|
os.system(command)
|
|
|
|
|
|
|
|
print "Bench runner done."
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|