aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.perf/gmonster2.exp
blob: b1f1c5f642dd3c40b6c43a561bf9b2a932b56227 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Copyright (C) 2015-2023 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Perftest description file for building the "gmonster2" benchmark.
# Where does the name come from?  The benchmark is derived from one of the
# monster programs at Google.
#
# Perftest descriptions are loaded thrice:
# 1) To generate the build .exp files
#    GDB_PERFTEST_MODE=gen-build-exps
#    This step allows for parallel builds of the majority of pieces of the
#    test binary and shlibs.
# 2) To compile the "pieces" of the binary and shlibs.
#    "Pieces" are the bulk of the machine-generated sources of the test.
#    This step is driven by lib/build-piece.exp.
#    GDB_PERFTEST_MODE=build-pieces
# 3) To perform the final link of the binary and shlibs.
#    GDB_PERFTEST_MODE=compile
#
# Example usage:
# bash$ make -j5 build-perf RUNTESTFLAGS="gmonster1.exp gmonster2.exp"
# bash$ make check-perf RUNTESTFLAGS="gdb.perf/gm*-*.exp GDB=/path/to/gdb"

load_lib perftest.exp
load_lib gen-perf-test.exp

require allow_perf_tests

if ![info exists MONSTER] {
    set MONSTER "n"
}

proc make_testcase_config { } {
    global MONSTER

    set program_name "gmonster2"
    array set testcase [GenPerfTest::init_testcase $program_name]

    set testcase(language) c++

    # *_{sources,headers} need to be embedded in an outer list
    # because remember each element of the outer list is for each run, and
    # here we want to use the same value for all runs.
    set testcase(binary_extra_sources) { { gmonster2.cc gm-hello.cc gm-use-cerr.cc } }
    set testcase(binary_extra_headers) { { gm-utils.h gm-std.h } }
    set testcase(gen_shlib_extra_sources) { { gm-hello.cc gm-use-cerr.cc } }
    set testcase(gen_shlib_extra_headers) { { gm-utils.h gm-std.h } }
    set testcase(tail_shlib_sources) { { gm-std.cc } }
    set testcase(tail_shlib_headers) { { gm-std.h } }

    if { $MONSTER == "y" } {
	set testcase(run_names) { 10-sos 100-sos 1000-sos }
	set testcase(nr_gen_shlibs) { 10 100 1000 }
    } else {
	set testcase(run_names) { 1-so 10-sos 100-sos }
	set testcase(nr_gen_shlibs) { 1 10 100 }
    }
    set testcase(nr_compunits) 10

    set testcase(nr_extern_globals) 10
    set testcase(nr_static_globals) 10
    set testcase(nr_extern_functions) 10
    set testcase(nr_static_functions) 10

    # class_specs needs to be embedded in an outer list because remember
    # each element of the outer list is for each run, and here we want to use
    # the same value for all runs.
    set testcase(class_specs) { {
	{
	    count 1 name { class }
	    nr_members 10 nr_static_members 10
	    nr_methods 10 nr_static_methods 10
	    nr_inline_methods 10 nr_static_inline_methods 10
	}
	{
	    count 1 name { ns0 class }
	    nr_members 10 nr_static_members 10
	    nr_methods 10 nr_static_methods 10
	    nr_inline_methods 10 nr_static_inline_methods 10
	}
	{
	    count 1 name { ns0 anonymous aclass }
	    nr_members 10 nr_static_members 10
	    nr_methods 10 nr_static_methods 10
	    nr_inline_methods 10 nr_static_inline_methods 10
	}
	{
	    count 1 name { ns0 ns1 class }
	    nr_members 10 nr_static_members 10
	    nr_methods 10 nr_static_methods 10
	    nr_inline_methods 10 nr_static_inline_methods 10
	}
	{
	    count 1 name { ns0 anonymous ns1 aclass }
	    nr_members 10 nr_static_members 10
	    nr_methods 10 nr_static_methods 10
	    nr_inline_methods 10 nr_static_inline_methods 10
	}
    } }

    return [array get testcase]
}

GenPerfTest::standard_compile_driver gmonster2.exp make_testcase_config