1 # Copyright (C) 2013-2023 Free Software Foundation, Inc.
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.
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.
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/>.
16 from perftest
import perftest
19 class BackTrace(perftest
.TestCaseWithBasicMeasurements
):
20 def __init__(self
, depth
):
21 super(BackTrace
, self
).__init
__("backtrace")
26 gdb
.execute("bt", False, True)
27 gdb
.execute("bt", False, True)
30 """Do backtrace multiple times."""
31 do_test_command
= "bt %d" % self
.depth
32 for _
in range(1, 15):
33 gdb
.execute(do_test_command
, False, True)
35 def execute_test(self
):
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.
44 gdb
.execute(line_size_command
)
45 gdb
.execute(size_command
)
47 func
= lambda: self
._do
_test
()
49 self
.measure
.measure(func
, line_size
)