xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.perf/gmonster1.exp (revision 6881a4007f077b54e5f51159c52b9b25f57deb0d)
1# Copyright (C) 2015-2023 Free Software Foundation, Inc.
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
16# Perftest description file for building the "gmonster1" benchmark.
17# Where does the name come from?  The benchmark is derived from one of the
18# monster programs at Google.
19#
20# Perftest descriptions are loaded thrice:
21# 1) To generate the build .exp files
22#    GDB_PERFTEST_MODE=gen-build-exps
23#    This step allows for parallel builds of the majority of pieces of the
24#    test binary and shlibs.
25# 2) To compile the "pieces" of the binary and shlibs.
26#    "Pieces" are the bulk of the machine-generated sources of the test.
27#    This step is driven by lib/build-piece.exp.
28#    GDB_PERFTEST_MODE=build-pieces
29# 3) To perform the final link of the binary and shlibs.
30#    GDB_PERFTEST_MODE=compile
31#
32# Example usage:
33# bash$ make -j5 build-perf RUNTESTFLAGS="gmonster1.exp gmonster2.exp"
34# bash$ make check-perf RUNTESTFLAGS="gdb.perf/gm*-*.exp GDB=/path/to/gdb"
35
36load_lib perftest.exp
37load_lib gen-perf-test.exp
38
39if [skip_perf_tests] {
40    return 0
41}
42
43if ![info exists MONSTER] {
44    set MONSTER "n"
45}
46
47proc make_testcase_config { } {
48    global MONSTER
49
50    set program_name "gmonster1"
51    array set testcase [GenPerfTest::init_testcase $program_name]
52
53    set testcase(language) c++
54
55    # *_{sources,headers} need to be embedded in an outer list
56    # because remember each element of the outer list is for each run, and
57    # here we want to use the same value for all runs.
58    set testcase(binary_extra_sources) { { gmonster1.cc gm-hello.cc gm-use-cerr.cc gm-pervasive-typedef.cc } }
59    set testcase(binary_extra_headers) { { <stdint.h> gm-utils.h gm-std.h gm-pervasive-typedef.h } }
60    set testcase(tail_shlib_sources) { { gm-std.cc } }
61    set testcase(tail_shlib_headers) { { gm-std.h } }
62
63    if { $MONSTER == "y" } {
64	set testcase(run_names) { 10-cus 100-cus 1000-cus 10000-cus }
65	set testcase(nr_compunits) { 10 100 1000 10000 }
66    } else {
67	set testcase(run_names) { 1-cu 10-cus 100-cus }
68	set testcase(nr_compunits) { 1 10 100 }
69    }
70    set testcase(nr_gen_shlibs) { 0 }
71
72    set testcase(nr_extern_globals) 10
73    set testcase(nr_static_globals) 10
74    set testcase(nr_extern_functions) 10
75    set testcase(nr_static_functions) 10
76
77    # class_specs needs to be embedded in an outer list because remember
78    # each element of the outer list is for each run, and here we want to use
79    # the same value for all runs.
80    set testcase(class_specs) { {
81	{
82	    count 1 name { class }
83	    nr_members 10 nr_static_members 10
84	    nr_methods 10 nr_static_methods 10
85	    nr_inline_methods 10 nr_static_inline_methods 10
86	}
87	{
88	    count 1 name { ns0 class }
89	    nr_members 10 nr_static_members 10
90	    nr_methods 10 nr_static_methods 10
91	    nr_inline_methods 10 nr_static_inline_methods 10
92	}
93	{
94	    count 1 name { ns0 anonymous aclass }
95	    nr_members 10 nr_static_members 10
96	    nr_methods 10 nr_static_methods 10
97	    nr_inline_methods 10 nr_static_inline_methods 10
98	}
99	{
100	    count 1 name { ns0 ns1 class }
101	    nr_members 10 nr_static_members 10
102	    nr_methods 10 nr_static_methods 10
103	    nr_inline_methods 10 nr_static_inline_methods 10
104	}
105	{
106	    count 1 name { ns0 anonymous ns1 aclass }
107	    nr_members 10 nr_static_members 10
108	    nr_methods 10 nr_static_methods 10
109	    nr_inline_methods 10 nr_static_inline_methods 10
110	}
111    } }
112
113    return [array get testcase]
114}
115
116GenPerfTest::standard_compile_driver gmonster1.exp make_testcase_config
117