150
|
1 """
|
|
2 Test lldb data formatter subsystem.
|
|
3 """
|
|
4
|
|
5 from __future__ import print_function
|
|
6
|
|
7
|
|
8 import lldb
|
|
9 from lldbsuite.test.decorators import *
|
|
10 from lldbsuite.test.lldbbench import *
|
|
11 from lldbsuite.test.lldbtest import *
|
|
12 from lldbsuite.test import lldbutil
|
|
13
|
|
14
|
|
15 class TestBenchmarkContinue(BenchBase):
|
|
16
|
|
17 mydir = TestBase.compute_mydir(__file__)
|
|
18
|
|
19 @benchmarks_test
|
|
20 def test_run_command(self):
|
|
21 """Benchmark different ways to continue a process"""
|
|
22 self.build()
|
|
23 self.data_formatter_commands()
|
|
24
|
|
25 def setUp(self):
|
|
26 # Call super's setUp().
|
|
27 BenchBase.setUp(self)
|
|
28
|
|
29 def data_formatter_commands(self):
|
|
30 """Benchmark different ways to continue a process"""
|
|
31 self.runCmd("file "+self.getBuildArtifact("a.out"),
|
|
32 CURRENT_EXECUTABLE_SET)
|
|
33
|
|
34 bkpt = self.target().FindBreakpointByID(
|
|
35 lldbutil.run_break_set_by_source_regexp(
|
|
36 self, "// break here"))
|
|
37
|
|
38 self.runCmd("run", RUN_SUCCEEDED)
|
|
39
|
|
40 # The stop reason of the thread should be breakpoint.
|
|
41 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
|
|
42 substrs=['stopped',
|
|
43 'stop reason = breakpoint'])
|
|
44
|
|
45 # This is the function to remove the custom formats in order to have a
|
|
46 # clean slate for the next test case.
|
|
47 def cleanup():
|
|
48 self.runCmd('type format clear', check=False)
|
|
49 self.runCmd('type summary clear', check=False)
|
|
50 self.runCmd('type filter clear', check=False)
|
|
51 self.runCmd('type synth clear', check=False)
|
|
52 self.runCmd(
|
|
53 "settings set target.max-children-count 256",
|
|
54 check=False)
|
|
55
|
|
56 # Execute the cleanup function during test case tear down.
|
|
57 self.addTearDownHook(cleanup)
|
|
58
|
|
59 runCmd_sw = Stopwatch()
|
|
60 lldbutil_sw = Stopwatch()
|
|
61
|
|
62 for i in range(0, 15):
|
|
63 runCmd_sw.start()
|
|
64 self.runCmd("continue")
|
|
65 runCmd_sw.stop()
|
|
66
|
|
67 for i in range(0, 15):
|
|
68 lldbutil_sw.start()
|
|
69 lldbutil.continue_to_breakpoint(self.process(), bkpt)
|
|
70 lldbutil_sw.stop()
|
|
71
|
|
72 print("runCmd: %s\nlldbutil: %s" % (runCmd_sw, lldbutil_sw))
|