[NFC][LLVM][CodeGen] Move LiveDebugVariables.h into llvm/include/llvm/CodeGen (#88374)
[llvm-project.git] / lldb / packages / Python / lldbsuite / test / bench.py
blob1a11b3ef4f0e643d661b7236dde782e0177f56ff
1 #!/usr/bin/env python
3 """
4 A simple bench runner which delegates to the ./dotest.py test driver to run the
5 benchmarks defined in the list named 'benches'.
7 You need to hand edit 'benches' to modify/change the command lines passed to the
8 test driver.
10 Use the following to get only the benchmark results in your terminal output:
12 ./bench.py -e /Volumes/data/lldb/svn/regression/build/Debug/lldb -x '-F Driver::MainLoop()' 2>&1 | grep -P '^lldb.*benchmark:'
13 """
15 import os
16 from optparse import OptionParser
18 # dotest.py invocation with no '-e exe-path' uses lldb as the inferior program,
19 # unless there is a mentioning of custom executable program.
20 benches = [
21 # Measure startup delays creating a target, setting a breakpoint, and run
22 # to breakpoint stop.
23 "./dotest.py -v +b %E %X -n -p TestStartupDelays.py",
24 # Measure 'frame variable' response after stopping at a breakpoint.
25 "./dotest.py -v +b %E %X -n -p TestFrameVariableResponse.py",
26 # Measure stepping speed after stopping at a breakpoint.
27 "./dotest.py -v +b %E %X -n -p TestSteppingSpeed.py",
28 # Measure expression cmd response with a simple custom executable program.
29 "./dotest.py +b -n -p TestExpressionCmd.py",
30 # Attach to a spawned process then run disassembly benchmarks.
31 "./dotest.py -v +b -n %E -p TestDoAttachThenDisassembly.py",
35 def main():
36 """Read the items from 'benches' and run the command line one by one."""
37 parser = OptionParser(
38 usage="""\
39 %prog [options]
40 Run the standard benchmarks defined in the list named 'benches'.\
41 """
43 parser.add_option(
44 "-e",
45 "--executable",
46 type="string",
47 action="store",
48 dest="exe",
49 help="The target program launched by lldb.",
51 parser.add_option(
52 "-x",
53 "--breakpoint-spec",
54 type="string",
55 action="store",
56 dest="break_spec",
57 help="The lldb breakpoint spec for the target program.",
60 # Parses the options, if any.
61 opts, args = parser.parse_args()
63 print("Starting bench runner....")
65 for item in benches:
66 command = item.replace("%E", '-e "%s"' % opts.exe if opts.exe else "")
67 command = command.replace(
68 "%X", '-x "%s"' % opts.break_spec if opts.break_spec else ""
70 print("Running %s" % (command))
71 os.system(command)
73 print("Bench runner done.")
76 if __name__ == "__main__":
77 main()