]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/benchmarks/libcxxmap/TestBenchmarkLibcxxMap.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / benchmarks / libcxxmap / TestBenchmarkLibcxxMap.py
1 """
2 Test lldb data formatter subsystem.
3 """
4
5 from __future__ import print_function
6
7
8
9 import os, time
10 import lldb
11 from lldbsuite.test.lldbbench import *
12 import lldbsuite.test.lldbutil as lldbutil
13
14 class TestBenchmarkLibcxxMap(BenchBase):
15
16     mydir = TestBase.compute_mydir(__file__)
17
18     @benchmarks_test
19     def test_run_command(self):
20         """Benchmark the std::map data formatter (libc++)"""
21         self.build()
22         self.data_formatter_commands()
23
24     def setUp(self):
25         # Call super's setUp().
26         BenchBase.setUp(self)
27
28     def data_formatter_commands(self):
29         """Benchmark the std::map data formatter (libc++)"""
30         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
31
32         bkpt = self.target().FindBreakpointByID(lldbutil.run_break_set_by_source_regexp (self, "break here"))
33
34         self.runCmd("run", RUN_SUCCEEDED)
35
36         # The stop reason of the thread should be breakpoint.
37         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
38             substrs = ['stopped',
39                        'stop reason = breakpoint'])
40
41         # This is the function to remove the custom formats in order to have a
42         # clean slate for the next test case.
43         def cleanup():
44             self.runCmd('type format clear', check=False)
45             self.runCmd('type summary clear', check=False)
46             self.runCmd('type filter clear', check=False)
47             self.runCmd('type synth clear', check=False)
48             self.runCmd("settings set target.max-children-count 256", check=False)
49
50         # Execute the cleanup function during test case tear down.
51         self.addTearDownHook(cleanup)
52         
53         sw = Stopwatch()
54         
55         sw.start()
56         self.expect('frame variable -A map', substrs=['[300]', '300'])
57         sw.stop()
58             
59         print("time to print: %s" % (sw))