summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-04-30 14:10:20 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-04-30 14:10:20 +0530
commitd569c6eeb48219993063f956e516704281602f7d (patch)
treeee4b52c88456865a025c5943ff6f0bb5b741ff0a /scripts
parenta6a242fe7cc0d7fcac1c9741d8be2ca8c2a5c744 (diff)
downloadglibc-d569c6eeb48219993063f956e516704281602f7d.tar.gz
Maintain runtime of each benchmark at ~10 seconds
The idea to run benchmarks for a constant number of iterations is problematic. While the benchmarks may run for 10 seconds on x86_64, they could run for about 30 seconds on powerpc and worse, over 3 minutes on arm. Besides that, adding a new benchmark is cumbersome since one needs to find out the number of iterations needed for a sufficient runtime. A better idea would be to run each benchmark for a specific amount of time. This patch does just that. The run time defaults to 10 seconds and it is configurable at command line: make BENCH_DURATION=5 bench
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/bench.pl12
1 files changed, 5 insertions, 7 deletions
diff --git a/scripts/bench.pl b/scripts/bench.pl
index bb7f64897e..5856cfa397 100755
--- a/scripts/bench.pl
+++ b/scripts/bench.pl
@@ -22,23 +22,22 @@ use warnings;
# Generate a benchmark source file for a given input.
if (@ARGV < 2) {
- die "Usage: bench.pl <function> <iterations> [parameter types] [return type]"
+ die "Usage: bench.pl <function> [parameter types] [return type]"
}
my $arg;
my $func = $ARGV[0];
-my $iters = $ARGV[1];
my @args;
my $ret = "void";
my $getret = "";
my $retval = "";
-if (@ARGV >= 3) {
- @args = split(':', $ARGV[2]);
+if (@ARGV >= 2) {
+ @args = split(':', $ARGV[1]);
}
-if (@ARGV == 4) {
- $ret = $ARGV[3];
+if (@ARGV == 3) {
+ $ret = $ARGV[2];
}
my $decl = "extern $ret $func (";
@@ -88,6 +87,5 @@ if ($ret ne "void") {
print "#define BENCH_FUNC(j) ({$getret CALL_BENCH_FUNC (j);})\n";
-print "#define ITER $iters\n";
print "#define FUNCNAME \"$func\"\n";
print "#include \"bench-skeleton.c\"\n";