]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.perf/backtrace.py
Update copyright year range in all GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.perf / backtrace.py
CommitLineData
e2882c85 1# Copyright (C) 2013-2018 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
18class BackTrace (perftest.TestCaseWithBasicMeasurements):
19 def __init__(self, depth):
20 super (BackTrace, self).__init__ ("backtrace")
21 self.depth = depth
22
23 def warm_up(self):
24 # Warm up.
25 gdb.execute ("bt", False, True)
26 gdb.execute ("bt", False, True)
27
28 def _do_test(self):
29 """Do backtrace multiple times."""
30 do_test_command = "bt %d" % self.depth
31 for _ in range(1, 15):
32 gdb.execute (do_test_command, False, True)
33
34 def execute_test(self):
35
36 line_size = 2
37 for _ in range(1, 12):
38 # Keep the total size of dcache unchanged, and increase the
39 # line-size in the loop.
40 line_size_command = "set dcache line-size %d" % (line_size)
41 size_command = "set dcache size %d" % (4096 * 64 / line_size)
42 # Cache is cleared by changing line-size or size.
43 gdb.execute (line_size_command)
44 gdb.execute (size_command)
45
46 func = lambda: self._do_test()
47
48 self.measure.measure(func, line_size)
49
50 line_size *= 2