aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-03-15 22:51:36 +0200
committerSergey Poznyakoff <gray@gnu.org>2020-03-15 22:51:36 +0200
commit0cdf95fd770c59a018a4018e49aa777d3ed34e45 (patch)
tree8b7fddb81a444735901d34f5c69806fe98cf68eb
parenta39bd26c6d6d5638407e57caaa3187aeb52517b1 (diff)
downloadcache-benchmarks-0cdf95fd770c59a018a4018e49aa777d3ed34e45.tar.gz
cache-benchmarks-0cdf95fd770c59a018a4018e49aa777d3ed34e45.tar.bz2
Use actual min and max times for errorbar. Limit the maxcache value by the number of buckets in the db plus 100.
m---------gdbm/newcache0
-rw-r--r--src/benchmark.mk.in2
-rw-r--r--src/gnuplot.m48
-rwxr-xr-xsrc/runtest39
4 files changed, 30 insertions, 19 deletions
diff --git a/gdbm/newcache b/gdbm/newcache
-Subproject 1f94a81a9f3a9955ca74dff07b7909595a85048
+Subproject 02bc2dc9bee96c0e7d93d23c6f0b7a24d0e1756
diff --git a/src/benchmark.mk.in b/src/benchmark.mk.in
index 9d8adff..5e02f11 100644
--- a/src/benchmark.mk.in
+++ b/src/benchmark.mk.in
@@ -25,13 +25,13 @@ test: master.log newcache.log
$(AM_V_GEN)MAXCACHE=$(MAXCACHE); \
$(abs_top_srcdir)/src/runtest -n $(NUMSAMPLES) $(RUNTESTOPT) \
--final $${MAXCACHE:-$$(($$($(GDBMTOOL) a.gdbm dir |\
sed -n -e '2{' \
-e 's/.*Buckets = //' \
-e 's/\.$$//' \
- -e 'p}') * 2))} \
+ -e 'p}') + 100))} \
--log-file=$*.log \
$(abs_top_builddir)/src/$*/fetchkeys
clean:
rm -f master.log newcache.log
allclean: clean
rm -f keys.txt a.gdbm
diff --git a/src/gnuplot.m4 b/src/gnuplot.m4
index 29126f5..392eb94 100644
--- a/src/gnuplot.m4
+++ b/src/gnuplot.m4
@@ -9,17 +9,17 @@ set ylabel 'Runtime (seconds)'
set style line 1 linecolor rgb "dark-red" linewidth 1.000 dashtype solid pointtype 1 pointsize default pointinterval 0
set style line 2 linecolor rgb "#e69f00" linewidth 1.000 dashtype solid pointtype 1 pointsize default pointinterval 0
set style line 3 linecolor rgb "blue" linewidth 1.000 dashtype solid pointtype 1 pointsize default pointinterval 0
set style line 4 linecolor rgb "#0072b2" linewidth 1.000 dashtype solid pointtype 1 pointsize default pointinterval 0
plot "master.log" \
- using 1:4:7 \
+ using 1:8:9:10 \
title "GDBM 1.18.1" with errorbars ls 1, \
- "" using 1:4 \
+ "" using 1:8 \
notitle \
smooth csplines ls 2, \
"newcache.log" \
- using 1:4:7 \
+ using 1:8:9:10 \
title "GDBM newcache" with errorbars ls 3, \
- "" using 1:4 \
+ "" using 1:8 \
notitle \
smooth csplines ls 4
diff --git a/src/runtest b/src/runtest
index 7c8885c..2a24481 100755
--- a/src/runtest
+++ b/src/runtest
@@ -13,20 +13,39 @@ my $nsamples = 1; # Number of times to run each test.
my $c_init = 100; # Initial cache capacity.
my $c_step = 100; # Cache capacity increment.
my $c_final = 100; # Final cache capacity.
my $drop_caches; # Drop system disk caches before each run.
my $log_file; # Name of the log file.
+use constant {
+ AVG => 0,
+ MIN => 1,
+ MAX => 2
+};
+
+sub init_times {
+ my ($t) = @_;
+ $t->[AVG] = 0;
+ $t->[MIN] = 100;
+ $t->[MAX] = 0;
+}
+
+sub update_times {
+ my ($t, $v) = @_;
+ $t->[AVG] += $v;
+ $t->[MIN] = $v if $t->[MIN] > $v;
+ $t->[MAX] = $v if $t->[MAX] < $v;
+};
+
sub runtest {
use constant {
TOTAL => 0,
OPEN => 1,
LOOP => 2
};
- my @times = (0,0,0);
- my @stddev = (0,0,0);
+ my @times = ([0,100,0],[0,100,0],[0,100,0]);
my $n;
for ($n = 0; $n < $nsamples; $n++) {
if ($drop_caches) {
system($drop_caches);
}
@@ -43,31 +62,23 @@ sub runtest {
print "$_";
}
}
close PH;
if (@inbuf == 3) {
- $times[TOTAL] += $inbuf[TOTAL];
- $times[OPEN] += $inbuf[OPEN];
- $times[LOOP] += $inbuf[LOOP];
-
- $stddev[TOTAL] += $inbuf[TOTAL] ** 2;
- $stddev[OPEN] += $inbuf[OPEN] ** 2;
- $stddev[LOOP] += $inbuf[LOOP] ** 2;
+ update_times($times[TOTAL], $inbuf[TOTAL]);
+ update_times($times[OPEN], $inbuf[OPEN]);
+ update_times($times[LOOP], $inbuf[LOOP]);
} else {
while (my $s = shift(@inbuf)) {
print "$s\n";
}
die "no timing info\n";
}
}
- for (my $i = 0; $i < @times; $i++) {
- $times[$i] /= $nsamples;
- $stddev[$i] = sqrt($stddev[$i] / $nsamples - $times[$i] ** 2);
- }
- return (@times, @stddev);
+ map { $_->[AVG] /= $nsamples; @$_ } @times;
}
GetOptions(
'n=n' => \$nsamples,
'init|i=n' => \$c_init,
'step|s=n' => \$c_step,

Return to:

Send suggestions and report system problems to the System administrator.