1# Copyright (C) 2015-2021 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 "gmonster2" 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 "gmonster2"
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) { { gmonster2.cc gm-hello.cc gm-use-cerr.cc } }
59    set testcase(binary_extra_headers) { { gm-utils.h gm-std.h } }
60    set testcase(gen_shlib_extra_sources) { { gm-hello.cc gm-use-cerr.cc } }
61    set testcase(gen_shlib_extra_headers) { { gm-utils.h gm-std.h } }
62    set testcase(tail_shlib_sources) { { gm-std.cc } }
63    set testcase(tail_shlib_headers) { { gm-std.h } }
64
65    if { $MONSTER == "y" } {
66	set testcase(run_names) { 10-sos 100-sos 1000-sos }
67	set testcase(nr_gen_shlibs) { 10 100 1000 }
68    } else {
69	set testcase(run_names) { 1-so 10-sos 100-sos }
70	set testcase(nr_gen_shlibs) { 1 10 100 }
71    }
72    set testcase(nr_compunits) 10
73
74    set testcase(nr_extern_globals) 10
75    set testcase(nr_static_globals) 10
76    set testcase(nr_extern_functions) 10
77    set testcase(nr_static_functions) 10
78
79    # class_specs needs to be embedded in an outer list because remember
80    # each element of the outer list is for each run, and here we want to use
81    # the same value for all runs.
82    set testcase(class_specs) { {
83	{
84	    count 1 name { class }
85	    nr_members 10 nr_static_members 10
86	    nr_methods 10 nr_static_methods 10
87	    nr_inline_methods 10 nr_static_inline_methods 10
88	}
89	{
90	    count 1 name { ns0 class }
91	    nr_members 10 nr_static_members 10
92	    nr_methods 10 nr_static_methods 10
93	    nr_inline_methods 10 nr_static_inline_methods 10
94	}
95	{
96	    count 1 name { ns0 anonymous aclass }
97	    nr_members 10 nr_static_members 10
98	    nr_methods 10 nr_static_methods 10
99	    nr_inline_methods 10 nr_static_inline_methods 10
100	}
101	{
102	    count 1 name { ns0 ns1 class }
103	    nr_members 10 nr_static_members 10
104	    nr_methods 10 nr_static_methods 10
105	    nr_inline_methods 10 nr_static_inline_methods 10
106	}
107	{
108	    count 1 name { ns0 anonymous ns1 aclass }
109	    nr_members 10 nr_static_members 10
110	    nr_methods 10 nr_static_methods 10
111	    nr_inline_methods 10 nr_static_inline_methods 10
112	}
113    } }
114
115    return [array get testcase]
116}
117
118GenPerfTest::standard_compile_driver gmonster2.exp make_testcase_config
119