Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / benchmarks / continue / TestBenchmarkContinue.py
blobf2f15b3347eaa060a5a32a72571311fe18225407
1 """
2 Test lldb data formatter subsystem.
3 """
5 import lldb
6 from lldbsuite.test.decorators import *
7 from lldbsuite.test.lldbbench import *
8 from lldbsuite.test.lldbtest import *
9 from lldbsuite.test import lldbutil
12 class TestBenchmarkContinue(BenchBase):
13 @benchmarks_test
14 def test_run_command(self):
15 """Benchmark different ways to continue a process"""
16 self.build()
17 self.data_formatter_commands()
19 def setUp(self):
20 # Call super's setUp().
21 BenchBase.setUp(self)
23 def data_formatter_commands(self):
24 """Benchmark different ways to continue a process"""
25 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
27 bkpt = self.target().FindBreakpointByID(
28 lldbutil.run_break_set_by_source_regexp(self, "// break here")
31 self.runCmd("run", RUN_SUCCEEDED)
33 # The stop reason of the thread should be breakpoint.
34 self.expect(
35 "thread list",
36 STOPPED_DUE_TO_BREAKPOINT,
37 substrs=["stopped", "stop reason = breakpoint"],
40 # This is the function to remove the custom formats in order to have a
41 # clean slate for the next test case.
42 def cleanup():
43 self.runCmd("type format clear", check=False)
44 self.runCmd("type summary clear", check=False)
45 self.runCmd("type filter clear", check=False)
46 self.runCmd("type synth clear", check=False)
47 self.runCmd("settings set target.max-children-count 256", check=False)
49 # Execute the cleanup function during test case tear down.
50 self.addTearDownHook(cleanup)
52 runCmd_sw = Stopwatch()
53 lldbutil_sw = Stopwatch()
55 for i in range(0, 15):
56 runCmd_sw.start()
57 self.runCmd("continue")
58 runCmd_sw.stop()
60 for i in range(0, 15):
61 lldbutil_sw.start()
62 lldbutil.continue_to_breakpoint(self.process(), bkpt)
63 lldbutil_sw.stop()
65 print("runCmd: %s\nlldbutil: %s" % (runCmd_sw, lldbutil_sw))