Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / benchmarks / libcxxlist / TestBenchmarkLibcxxList.py
blob01de980f3bc15c0f2924a1fa6b9b1600853e371f
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 TestBenchmarkLibcxxList(BenchBase):
13 @benchmarks_test
14 def test_run_command(self):
15 """Benchmark the std::list data formatter (libc++)"""
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 the std::list data formatter (libc++)"""
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 sw = Stopwatch()
54 sw.start()
55 self.expect("frame variable -A list", substrs=["[300]", "300"])
56 sw.stop()
58 print("time to print: %s" % (sw))