mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 01:50:24 +08:00
Add gmonster-{1,2} perf testcases.
These testcases are mocks of real programs. GDB doesn't care what the programs do, they just have to look and/or behave like the real program. These testcases exercise gdb when debugging really large programs. E.g., gmonster-1 has 10,000 CUs, and gmonster-2 has 1000 shared libs (which is actually a little small, 5000 would be more accurate). gdb/testsuite/ChangeLog: * gdb.perf/lib/perftest/utils.py: New file. * gdb.perf/gm-hello.cc: New file. * gdb.perf/gm-pervasive-typedef.cc: New file. * gdb.perf/gm-pervasive-typedef.h: New file. * gdb.perf/gm-std.cc: New file. * gdb.perf/gm-std.h: New file. * gdb.perf/gm-use-cerr.cc: New file. * gdb.perf/gm-utils.h: New file. * gdb.perf/gmonster-null-lookup.py: New file. * gdb.perf/gmonster-pervasive-typedef.py: New file. * gdb.perf/gmonster-print-cerr.py: New file. * gdb.perf/gmonster-ptype-string.py: New file. * gdb.perf/gmonster-runto-main.py: New file. * gdb.perf/gmonster-select-file.py: New file. * gdb.perf/gmonster1-null-lookup.exp: New file. * gdb.perf/gmonster1-pervasive-typedef.exp: New file. * gdb.perf/gmonster1-print-cerr.exp: New file. * gdb.perf/gmonster1-ptype-string.exp: New file. * gdb.perf/gmonster1-runto-main.exp: New file. * gdb.perf/gmonster1-select-file.exp: New file. * gdb.perf/gmonster1.cc: New file. * gdb.perf/gmonster1.exp: New file. * gdb.perf/gmonster2-null-lookup.exp: New file. * gdb.perf/gmonster2-pervasive-typedef.exp: New file. * gdb.perf/gmonster2-print-cerr.exp: New file. * gdb.perf/gmonster2-ptype-string.exp: New file. * gdb.perf/gmonster2-runto-main.exp: New file. * gdb.perf/gmonster2-select-file.exp: New file. * gdb.perf/gmonster2.cc: New file. * gdb.perf/gmonster2.exp: New file.
This commit is contained in:
25
gdb/testsuite/gdb.perf/gm-hello.cc
Normal file
25
gdb/testsuite/gdb.perf/gm-hello.cc
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/* Copyright (C) 2015 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/>. */
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "gm-utils.h"
|
||||||
|
|
||||||
|
#ifdef SHLIB
|
||||||
|
#define HELLO CONCAT2 (hello_, SHLIB)
|
||||||
|
#else
|
||||||
|
#define HELLO hello
|
||||||
|
#endif
|
||||||
|
|
||||||
|
std::string HELLO ("Hello.");
|
30
gdb/testsuite/gdb.perf/gm-pervasive-typedef.cc
Normal file
30
gdb/testsuite/gdb.perf/gm-pervasive-typedef.cc
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/* Copyright (C) 2015 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/>. */
|
||||||
|
|
||||||
|
#include "gm-pervasive-typedef.h"
|
||||||
|
|
||||||
|
my_int use_of_my_int;
|
||||||
|
|
||||||
|
void
|
||||||
|
call_use_my_int_1 (my_int x)
|
||||||
|
{
|
||||||
|
use_of_my_int = use_my_int (x);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
call_use_my_int ()
|
||||||
|
{
|
||||||
|
call_use_my_int_1 (42);
|
||||||
|
}
|
30
gdb/testsuite/gdb.perf/gm-pervasive-typedef.h
Normal file
30
gdb/testsuite/gdb.perf/gm-pervasive-typedef.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/* Copyright (C) 2015 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/>. */
|
||||||
|
|
||||||
|
/* This file is used to create the conditions for the perf regression
|
||||||
|
in pr 16253. */
|
||||||
|
|
||||||
|
#ifndef GM_PERVASIVE_TYPEDEF_H
|
||||||
|
#define GM_PERVASIVE_TYPEDEF_H
|
||||||
|
|
||||||
|
typedef int my_int;
|
||||||
|
|
||||||
|
static my_int
|
||||||
|
use_my_int (my_int x)
|
||||||
|
{
|
||||||
|
return x + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* GM_PERVASIVE_TYPEDEF_H */
|
36
gdb/testsuite/gdb.perf/gm-std.cc
Normal file
36
gdb/testsuite/gdb.perf/gm-std.cc
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/* Copyright (C) 2015 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/>. */
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include "gm-std.h"
|
||||||
|
|
||||||
|
namespace gm_std
|
||||||
|
{
|
||||||
|
|
||||||
|
ostream cerr;
|
||||||
|
|
||||||
|
void
|
||||||
|
init ()
|
||||||
|
{
|
||||||
|
cerr.stream = &std::cerr;
|
||||||
|
}
|
||||||
|
|
||||||
|
template class basic_ostream<char>;
|
||||||
|
|
||||||
|
template
|
||||||
|
ostream&
|
||||||
|
operator<< (ostream& out, const char* s);
|
||||||
|
|
||||||
|
}
|
57
gdb/testsuite/gdb.perf/gm-std.h
Normal file
57
gdb/testsuite/gdb.perf/gm-std.h
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/* Copyright (C) 2015 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/>. */
|
||||||
|
|
||||||
|
#ifndef GM_STD_H
|
||||||
|
#define GM_STD_H
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
namespace gm_std
|
||||||
|
{
|
||||||
|
|
||||||
|
// Mock std::cerr, so we don't have to worry about the vagaries of the
|
||||||
|
// system-provided one. E.g., gcc pr 65669.
|
||||||
|
// This contains just enough to exercise what we want to.
|
||||||
|
template<typename T>
|
||||||
|
class basic_ostream
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::ostream *stream;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
basic_ostream<T>&
|
||||||
|
operator<< (basic_ostream<T>& out, const char* s)
|
||||||
|
{
|
||||||
|
(*out.stream) << s;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef basic_ostream<char> ostream;
|
||||||
|
|
||||||
|
// Inhibit implicit instantiations for required instantiations,
|
||||||
|
// which are defined via explicit instantiations elsewhere.
|
||||||
|
extern template class basic_ostream<char>;
|
||||||
|
extern template ostream& operator<< (ostream&, const char*);
|
||||||
|
|
||||||
|
extern ostream cerr;
|
||||||
|
|
||||||
|
// Call this from main so we don't have to do the same tricks that
|
||||||
|
// libstcd++ does with ios init'n.
|
||||||
|
extern void init ();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* GM_STD_H */
|
29
gdb/testsuite/gdb.perf/gm-use-cerr.cc
Normal file
29
gdb/testsuite/gdb.perf/gm-use-cerr.cc
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/* Copyright (C) 2015 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/>. */
|
||||||
|
|
||||||
|
#include "gm-std.h"
|
||||||
|
#include "gm-utils.h"
|
||||||
|
|
||||||
|
#ifdef SHLIB
|
||||||
|
#define WRITE_CERR XCONCAT2 (write_cerr_, SHLIB)
|
||||||
|
#else
|
||||||
|
#define WRITE_CERR write_cerr
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void
|
||||||
|
WRITE_CERR ()
|
||||||
|
{
|
||||||
|
gm_std::cerr << "Yikes!\n";
|
||||||
|
}
|
25
gdb/testsuite/gdb.perf/gm-utils.h
Normal file
25
gdb/testsuite/gdb.perf/gm-utils.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/* Copyright (C) 2015 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/>. */
|
||||||
|
|
||||||
|
#ifndef GM_UTILS_H
|
||||||
|
#define GM_UTILS_H
|
||||||
|
|
||||||
|
/* Names borrowed from include/symcat.h. */
|
||||||
|
#define CONCAT2(a,b) a ## b
|
||||||
|
#define XCONCAT2(a,b) CONCAT2 (a, b)
|
||||||
|
#define STRINGX(s) #s
|
||||||
|
#define XSTRING(s) STRINGX (s)
|
||||||
|
|
||||||
|
#endif /* GM_UTILS_H */
|
46
gdb/testsuite/gdb.perf/gmonster-null-lookup.py
Normal file
46
gdb/testsuite/gdb.perf/gmonster-null-lookup.py
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Test handling of lookup of a symbol that doesn't exist.
|
||||||
|
# Efficient handling of this case is important, and not just for typos.
|
||||||
|
# Sometimes the debug info for the needed object isn't present.
|
||||||
|
|
||||||
|
from perftest import perftest
|
||||||
|
from perftest import measure
|
||||||
|
from perftest import utils
|
||||||
|
|
||||||
|
class NullLookup(perftest.TestCaseWithBasicMeasurements):
|
||||||
|
def __init__(self, name, run_names, binfile):
|
||||||
|
# We want to measure time in this test.
|
||||||
|
super(NullLookup, self).__init__(name)
|
||||||
|
self.run_names = run_names
|
||||||
|
self.binfile = binfile
|
||||||
|
|
||||||
|
def warm_up(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def execute_test(self):
|
||||||
|
for run in self.run_names:
|
||||||
|
this_run_binfile = "%s-%s" % (self.binfile,
|
||||||
|
utils.convert_spaces(run))
|
||||||
|
utils.select_file(this_run_binfile)
|
||||||
|
utils.runto_main()
|
||||||
|
utils.safe_execute("mt expand-symtabs")
|
||||||
|
iteration = 5
|
||||||
|
while iteration > 0:
|
||||||
|
utils.safe_execute("mt flush-symbol-cache")
|
||||||
|
func = lambda: utils.safe_execute("p symbol_not_found")
|
||||||
|
self.measure.measure(func, run)
|
||||||
|
iteration -= 1
|
45
gdb/testsuite/gdb.perf/gmonster-pervasive-typedef.py
Normal file
45
gdb/testsuite/gdb.perf/gmonster-pervasive-typedef.py
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure the speed of "ptype func" where a parameter of the function is a
|
||||||
|
# typedef used pervasively. This exercises the perf regression introduced by
|
||||||
|
# the original patch to pr 16253.
|
||||||
|
|
||||||
|
from perftest import perftest
|
||||||
|
from perftest import measure
|
||||||
|
from perftest import utils
|
||||||
|
|
||||||
|
class PervasiveTypedef(perftest.TestCaseWithBasicMeasurements):
|
||||||
|
def __init__(self, name, run_names, binfile):
|
||||||
|
# We want to measure time in this test.
|
||||||
|
super(PervasiveTypedef, self).__init__(name)
|
||||||
|
self.run_names = run_names
|
||||||
|
self.binfile = binfile
|
||||||
|
|
||||||
|
def warm_up(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def func(self):
|
||||||
|
utils.select_file(self.this_run_binfile)
|
||||||
|
utils.safe_execute("ptype call_use_my_int_1")
|
||||||
|
|
||||||
|
def execute_test(self):
|
||||||
|
for run in self.run_names:
|
||||||
|
self.this_run_binfile = "%s-%s" % (self.binfile,
|
||||||
|
utils.convert_spaces(run))
|
||||||
|
iteration = 5
|
||||||
|
while iteration > 0:
|
||||||
|
self.measure.measure(self.func, run)
|
||||||
|
iteration -= 1
|
52
gdb/testsuite/gdb.perf/gmonster-print-cerr.py
Normal file
52
gdb/testsuite/gdb.perf/gmonster-print-cerr.py
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Test printing of std::cerr.
|
||||||
|
# libstdc++ is typically near the end of the list of shared libraries,
|
||||||
|
# and thus searched last (or near last).
|
||||||
|
# Plus llvm had a bug where its pubnames output that gold uses to generate
|
||||||
|
# the index caused a massive perf regression (basically it emitted an entry
|
||||||
|
# for every CU that used it, whereas we only want the CU with the
|
||||||
|
# definition).
|
||||||
|
#
|
||||||
|
# Note: One difference between this test and gmonster-ptype-string.py
|
||||||
|
# is that here we do not pre-expand the symtab: we don't want include
|
||||||
|
# GDB's slowness in searching expanded symtabs first to color these results.
|
||||||
|
|
||||||
|
from perftest import perftest
|
||||||
|
from perftest import measure
|
||||||
|
from perftest import utils
|
||||||
|
|
||||||
|
class PrintCerr(perftest.TestCaseWithBasicMeasurements):
|
||||||
|
def __init__(self, name, run_names, binfile):
|
||||||
|
super(PrintCerr, self).__init__(name)
|
||||||
|
self.run_names = run_names
|
||||||
|
self.binfile = binfile
|
||||||
|
|
||||||
|
def warm_up(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def execute_test(self):
|
||||||
|
for run in self.run_names:
|
||||||
|
this_run_binfile = "%s-%s" % (self.binfile,
|
||||||
|
utils.convert_spaces(run))
|
||||||
|
utils.select_file(this_run_binfile)
|
||||||
|
utils.runto_main()
|
||||||
|
iteration = 5
|
||||||
|
while iteration > 0:
|
||||||
|
utils.safe_execute("mt flush-symbol-cache")
|
||||||
|
func = lambda: utils.safe_execute("print gm_std::cerr")
|
||||||
|
self.measure.measure(func, run)
|
||||||
|
iteration -= 1
|
48
gdb/testsuite/gdb.perf/gmonster-ptype-string.py
Normal file
48
gdb/testsuite/gdb.perf/gmonster-ptype-string.py
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure speed of ptype of a std::string object.
|
||||||
|
# The difference between this test and gmonster-print-cerr.py is that
|
||||||
|
# here we are working with fully expanded symtabs. GDB searches
|
||||||
|
# these before it searches the index (there is work-in-progress to fix this),
|
||||||
|
# this test helps measure the issue.
|
||||||
|
|
||||||
|
from perftest import perftest
|
||||||
|
from perftest import measure
|
||||||
|
from perftest import utils
|
||||||
|
|
||||||
|
class GmonsterPtypeString(perftest.TestCaseWithBasicMeasurements):
|
||||||
|
def __init__(self, name, run_names, binfile):
|
||||||
|
super(GmonsterPtypeString, self).__init__(name)
|
||||||
|
self.run_names = run_names
|
||||||
|
self.binfile = binfile
|
||||||
|
|
||||||
|
def warm_up(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def execute_test(self):
|
||||||
|
for run in self.run_names:
|
||||||
|
this_run_binfile = "%s-%s" % (self.binfile,
|
||||||
|
utils.convert_spaces(run))
|
||||||
|
utils.select_file(this_run_binfile)
|
||||||
|
utils.runto_main()
|
||||||
|
utils.safe_execute("mt expand-symtabs")
|
||||||
|
iteration = 5
|
||||||
|
while iteration > 0:
|
||||||
|
utils.safe_execute("mt flush-symbol-cache")
|
||||||
|
func1 = lambda: utils.safe_execute("ptype hello")
|
||||||
|
func = lambda: utils.run_n_times(2, func1)
|
||||||
|
self.measure.measure(func, run)
|
||||||
|
iteration -= 1
|
40
gdb/testsuite/gdb.perf/gmonster-runto-main.py
Normal file
40
gdb/testsuite/gdb.perf/gmonster-runto-main.py
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure performance of running to main.
|
||||||
|
|
||||||
|
from perftest import perftest
|
||||||
|
from perftest import measure
|
||||||
|
from perftest import utils
|
||||||
|
|
||||||
|
class GmonsterRuntoMain(perftest.TestCaseWithBasicMeasurements):
|
||||||
|
def __init__(self, name, run_names, binfile):
|
||||||
|
super(GmonsterRuntoMain, self).__init__(name)
|
||||||
|
self.run_names = run_names
|
||||||
|
self.binfile = binfile
|
||||||
|
|
||||||
|
def warm_up(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def execute_test(self):
|
||||||
|
for run in self.run_names:
|
||||||
|
this_run_binfile = "%s-%s" % (self.binfile,
|
||||||
|
utils.convert_spaces(run))
|
||||||
|
utils.select_file(this_run_binfile)
|
||||||
|
iteration = 5
|
||||||
|
while iteration > 0:
|
||||||
|
func = lambda: utils.runto_main()
|
||||||
|
self.measure.measure(func, run)
|
||||||
|
iteration -= 1
|
43
gdb/testsuite/gdb.perf/gmonster-select-file.py
Normal file
43
gdb/testsuite/gdb.perf/gmonster-select-file.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure performance of selecting a file to debug.
|
||||||
|
|
||||||
|
from perftest import perftest
|
||||||
|
from perftest import measure
|
||||||
|
from perftest import utils
|
||||||
|
|
||||||
|
class GmonsterSelectFile(perftest.TestCaseWithBasicMeasurements):
|
||||||
|
def __init__(self, name, run_names, binfile):
|
||||||
|
super(GmonsterSelectFile, self).__init__(name)
|
||||||
|
self.run_names = run_names
|
||||||
|
self.binfile = binfile
|
||||||
|
|
||||||
|
def warm_up(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _doit(self, binfile):
|
||||||
|
utils.select_file(None)
|
||||||
|
utils.select_file(binfile)
|
||||||
|
|
||||||
|
def execute_test(self):
|
||||||
|
for run in self.run_names:
|
||||||
|
this_run_binfile = "%s-%s" % (self.binfile,
|
||||||
|
utils.convert_spaces(run))
|
||||||
|
iteration = 5
|
||||||
|
while iteration > 0:
|
||||||
|
func = lambda: self._doit(this_run_binfile)
|
||||||
|
self.measure.measure(func, run)
|
||||||
|
iteration -= 1
|
26
gdb/testsuite/gdb.perf/gmonster1-null-lookup.exp
Normal file
26
gdb/testsuite/gdb.perf/gmonster1-null-lookup.exp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure speed of lookup of a symbol that doesn't exist.
|
||||||
|
# Test parameters are the standard GenPerfTest parameters.
|
||||||
|
|
||||||
|
load_lib perftest.exp
|
||||||
|
load_lib gen-perf-test.exp
|
||||||
|
|
||||||
|
if [skip_perf_tests] {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
GenPerfTest::standard_run_driver gmonster1.exp make_testcase_config gmonster-null-lookup.py NullLookup
|
28
gdb/testsuite/gdb.perf/gmonster1-pervasive-typedef.exp
Normal file
28
gdb/testsuite/gdb.perf/gmonster1-pervasive-typedef.exp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure the speed of "ptype func" where a parameter of the function is a
|
||||||
|
# typedef used pervasively. This exercises the perf regression introduced by
|
||||||
|
# the original patch to pr 16253.
|
||||||
|
# Test parameters are the standard GenPerfTest parameters.
|
||||||
|
|
||||||
|
load_lib perftest.exp
|
||||||
|
load_lib gen-perf-test.exp
|
||||||
|
|
||||||
|
if [skip_perf_tests] {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
GenPerfTest::standard_run_driver gmonster1.exp make_testcase_config gmonster-pervasive-typedef.py PervasiveTypedef
|
26
gdb/testsuite/gdb.perf/gmonster1-print-cerr.exp
Normal file
26
gdb/testsuite/gdb.perf/gmonster1-print-cerr.exp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure speed of printing std::cerr.
|
||||||
|
# Test parameters are the standard GenPerfTest parameters.
|
||||||
|
|
||||||
|
load_lib perftest.exp
|
||||||
|
load_lib gen-perf-test.exp
|
||||||
|
|
||||||
|
if [skip_perf_tests] {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
GenPerfTest::standard_run_driver gmonster1.exp make_testcase_config gmonster-print-cerr.py PrintCerr
|
26
gdb/testsuite/gdb.perf/gmonster1-ptype-string.exp
Normal file
26
gdb/testsuite/gdb.perf/gmonster1-ptype-string.exp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure speed of ptype on a simple class in a library that is searched late.
|
||||||
|
# Test parameters are the standard GenPerfTest parameters.
|
||||||
|
|
||||||
|
load_lib perftest.exp
|
||||||
|
load_lib gen-perf-test.exp
|
||||||
|
|
||||||
|
if [skip_perf_tests] {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
GenPerfTest::standard_run_driver gmonster1.exp make_testcase_config gmonster-ptype-string.py GmonsterPtypeString
|
26
gdb/testsuite/gdb.perf/gmonster1-runto-main.exp
Normal file
26
gdb/testsuite/gdb.perf/gmonster1-runto-main.exp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure performance of running to main.
|
||||||
|
# Test parameters are the standard GenPerfTest parameters.
|
||||||
|
|
||||||
|
load_lib perftest.exp
|
||||||
|
load_lib gen-perf-test.exp
|
||||||
|
|
||||||
|
if [skip_perf_tests] {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
GenPerfTest::standard_run_driver gmonster1.exp make_testcase_config gmonster-runto-main.py GmonsterRuntoMain
|
26
gdb/testsuite/gdb.perf/gmonster1-select-file.exp
Normal file
26
gdb/testsuite/gdb.perf/gmonster1-select-file.exp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure performance of selecting a file to debug.
|
||||||
|
# Test parameters are the standard GenPerfTest parameters.
|
||||||
|
|
||||||
|
load_lib perftest.exp
|
||||||
|
load_lib gen-perf-test.exp
|
||||||
|
|
||||||
|
if [skip_perf_tests] {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
GenPerfTest::standard_run_driver gmonster1.exp make_testcase_config gmonster-select-file.py GmonsterSelectFile
|
24
gdb/testsuite/gdb.perf/gmonster1.cc
Normal file
24
gdb/testsuite/gdb.perf/gmonster1.cc
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/* Copyright (C) 2015 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/>. */
|
||||||
|
|
||||||
|
#include "gm-std.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
gm_std::init ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
116
gdb/testsuite/gdb.perf/gmonster1.exp
Normal file
116
gdb/testsuite/gdb.perf/gmonster1.exp
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
# Copyright (C) 2015 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 "gmonster1" 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
|
||||||
|
|
||||||
|
if [skip_perf_tests] {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if ![info exists MONSTER] {
|
||||||
|
set MONSTER "n"
|
||||||
|
}
|
||||||
|
|
||||||
|
proc make_testcase_config { } {
|
||||||
|
global MONSTER
|
||||||
|
|
||||||
|
set program_name "gmonster1"
|
||||||
|
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) { { gmonster1.cc gm-hello.cc gm-use-cerr.cc gm-pervasive-typedef.cc } }
|
||||||
|
set testcase(binary_extra_headers) { { <stdint.h> gm-utils.h gm-std.h gm-pervasive-typedef.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-cus 100-cus 1000-cus 10000-cus }
|
||||||
|
set testcase(nr_compunits) { 10 100 1000 10000 }
|
||||||
|
} else {
|
||||||
|
set testcase(run_names) { 1-cu 10-cus 100-cus }
|
||||||
|
set testcase(nr_compunits) { 1 10 100 }
|
||||||
|
}
|
||||||
|
set testcase(nr_gen_shlibs) { 0 }
|
||||||
|
|
||||||
|
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 gmonster1.exp make_testcase_config
|
27
gdb/testsuite/gdb.perf/gmonster2-null-lookup.exp
Normal file
27
gdb/testsuite/gdb.perf/gmonster2-null-lookup.exp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure speed of lookup of a symbol that doesn't exist
|
||||||
|
# with lots of shared libraries.
|
||||||
|
# Test parameters are the standard GenPerfTest parameters.
|
||||||
|
|
||||||
|
load_lib perftest.exp
|
||||||
|
load_lib gen-perf-test.exp
|
||||||
|
|
||||||
|
if [skip_perf_tests] {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
GenPerfTest::standard_run_driver gmonster2.exp make_testcase_config gmonster-null-lookup.py NullLookup
|
28
gdb/testsuite/gdb.perf/gmonster2-pervasive-typedef.exp
Normal file
28
gdb/testsuite/gdb.perf/gmonster2-pervasive-typedef.exp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure the speed of "ptype func" where a parameter of the function is a
|
||||||
|
# typedef used pervasively. This exercises the perf regression introduced by
|
||||||
|
# the original patch to pr 16253.
|
||||||
|
# Test parameters are the standard GenPerfTest parameters.
|
||||||
|
|
||||||
|
load_lib perftest.exp
|
||||||
|
load_lib gen-perf-test.exp
|
||||||
|
|
||||||
|
if [skip_perf_tests] {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
GenPerfTest::standard_run_driver gmonster2.exp make_testcase_config gmonster-pervasive-typedef.py PervasiveTypedef
|
26
gdb/testsuite/gdb.perf/gmonster2-print-cerr.exp
Normal file
26
gdb/testsuite/gdb.perf/gmonster2-print-cerr.exp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure speed of printing std::cerr with lots of shared libraries.
|
||||||
|
# Test parameters are the standard GenPerfTest parameters.
|
||||||
|
|
||||||
|
load_lib perftest.exp
|
||||||
|
load_lib gen-perf-test.exp
|
||||||
|
|
||||||
|
if [skip_perf_tests] {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
GenPerfTest::standard_run_driver gmonster2.exp make_testcase_config gmonster-print-cerr.py PrintCerr
|
27
gdb/testsuite/gdb.perf/gmonster2-ptype-string.exp
Normal file
27
gdb/testsuite/gdb.perf/gmonster2-ptype-string.exp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure speed of ptype on a simple class in a library that is searched late
|
||||||
|
# with lots of shared libraries
|
||||||
|
# Test parameters are the standard GenPerfTest parameters.
|
||||||
|
|
||||||
|
load_lib perftest.exp
|
||||||
|
load_lib gen-perf-test.exp
|
||||||
|
|
||||||
|
if [skip_perf_tests] {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
GenPerfTest::standard_run_driver gmonster2.exp make_testcase_config gmonster-ptype-string.py GmonsterPtypeString
|
26
gdb/testsuite/gdb.perf/gmonster2-runto-main.exp
Normal file
26
gdb/testsuite/gdb.perf/gmonster2-runto-main.exp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure performance of running to main with lots of shared libraries
|
||||||
|
# Test parameters are the standard GenPerfTest parameters.
|
||||||
|
|
||||||
|
load_lib perftest.exp
|
||||||
|
load_lib gen-perf-test.exp
|
||||||
|
|
||||||
|
if [skip_perf_tests] {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
GenPerfTest::standard_run_driver gmonster2.exp make_testcase_config gmonster-runto-main.py GmonsterRuntoMain
|
27
gdb/testsuite/gdb.perf/gmonster2-select-file.exp
Normal file
27
gdb/testsuite/gdb.perf/gmonster2-select-file.exp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
# Measure performance of selecting a file to debug
|
||||||
|
# with lots of shared libraries
|
||||||
|
# Test parameters are the standard GenPerfTest parameters.
|
||||||
|
|
||||||
|
load_lib perftest.exp
|
||||||
|
load_lib gen-perf-test.exp
|
||||||
|
|
||||||
|
if [skip_perf_tests] {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
GenPerfTest::standard_run_driver gmonster2.exp make_testcase_config gmonster-select-file.py GmonsterSelectFile
|
24
gdb/testsuite/gdb.perf/gmonster2.cc
Normal file
24
gdb/testsuite/gdb.perf/gmonster2.cc
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/* Copyright (C) 2015 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/>. */
|
||||||
|
|
||||||
|
#include "gm-std.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
gm_std::init ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
118
gdb/testsuite/gdb.perf/gmonster2.exp
Normal file
118
gdb/testsuite/gdb.perf/gmonster2.exp
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
# Copyright (C) 2015 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
|
||||||
|
|
||||||
|
if [skip_perf_tests] {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
68
gdb/testsuite/gdb.perf/lib/perftest/utils.py
Normal file
68
gdb/testsuite/gdb.perf/lib/perftest/utils.py
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
# Copyright (C) 2015 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/>.
|
||||||
|
|
||||||
|
import gdb
|
||||||
|
|
||||||
|
def safe_execute(command):
|
||||||
|
"""Execute command, ignoring any gdb errors."""
|
||||||
|
result = None
|
||||||
|
try:
|
||||||
|
result = gdb.execute(command, to_string=True)
|
||||||
|
except gdb.error:
|
||||||
|
pass
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def convert_spaces(file_name):
|
||||||
|
"""Return file_name with all spaces replaced with "-"."""
|
||||||
|
return file_name.replace(" ", "-")
|
||||||
|
|
||||||
|
|
||||||
|
def select_file(file_name):
|
||||||
|
"""Select a file for debugging.
|
||||||
|
|
||||||
|
N.B. This turns confirmation off.
|
||||||
|
"""
|
||||||
|
safe_execute("set confirm off")
|
||||||
|
print ("Selecting file %s" % (file_name))
|
||||||
|
if file_name is None:
|
||||||
|
gdb.execute("file")
|
||||||
|
else:
|
||||||
|
gdb.execute("file %s" % (file_name))
|
||||||
|
|
||||||
|
|
||||||
|
def runto(location):
|
||||||
|
"""Run the program to location.
|
||||||
|
|
||||||
|
N.B. This turns confirmation off.
|
||||||
|
"""
|
||||||
|
safe_execute("set confirm off")
|
||||||
|
gdb.execute("tbreak %s" % (location))
|
||||||
|
gdb.execute("run")
|
||||||
|
|
||||||
|
|
||||||
|
def runto_main():
|
||||||
|
"""Run the program to "main".
|
||||||
|
|
||||||
|
N.B. This turns confirmation off.
|
||||||
|
"""
|
||||||
|
runto("main")
|
||||||
|
|
||||||
|
|
||||||
|
def run_n_times(count, func):
|
||||||
|
"""Execute func count times."""
|
||||||
|
while count > 0:
|
||||||
|
func()
|
||||||
|
count -= 1
|
Reference in New Issue
Block a user