Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.perf / backtrace.py
CommitLineData
88b9d363 1# Copyright (C) 2013-2022 Free Software Foundation, Inc.
23e9d3b9
YQ
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16from perftest import perftest
17
13123da8
SM
18
19class BackTrace(perftest.TestCaseWithBasicMeasurements):
23e9d3b9 20 def __init__(self, depth):
13123da8 21 super(BackTrace, self).__init__("backtrace")
23e9d3b9
YQ
22 self.depth = depth
23
24 def warm_up(self):
25 # Warm up.
13123da8
SM
26 gdb.execute("bt", False, True)
27 gdb.execute("bt", False, True)
23e9d3b9
YQ
28
29 def _do_test(self):
30 """Do backtrace multiple times."""
31 do_test_command = "bt %d" % self.depth
32 for _ in range(1, 15):
13123da8 33 gdb.execute(do_test_command, False, True)
23e9d3b9
YQ
34
35 def execute_test(self):
36
37 line_size = 2
38 for _ in range(1, 12):
39 # Keep the total size of dcache unchanged, and increase the
40 # line-size in the loop.
41 line_size_command = "set dcache line-size %d" % (line_size)
42 size_command = "set dcache size %d" % (4096 * 64 / line_size)
43 # Cache is cleared by changing line-size or size.
13123da8
SM
44 gdb.execute(line_size_command)
45 gdb.execute(size_command)
23e9d3b9
YQ
46
47 func = lambda: self._do_test()
48
49 self.measure.measure(func, line_size)
50
51 line_size *= 2
This page took 0.973276 seconds and 4 git commands to generate.