From 0cdf95fd770c59a018a4018e49aa777d3ed34e45 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sun, 15 Mar 2020 22:51:36 +0200 Subject: Use actual min and max times for errorbar. Limit the maxcache value by the number of buckets in the db plus 100. --- gdbm/newcache | 2 +- src/benchmark.mk.in | 2 +- src/gnuplot.m4 | 8 ++++---- src/runtest | 39 +++++++++++++++++++++++++-------------- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/gdbm/newcache b/gdbm/newcache index 1f94a81..02bc2dc 160000 --- a/gdbm/newcache +++ b/gdbm/newcache @@ -1 +1 @@ -Subproject commit 1f94a81a9f3a9955ca74dff07b7909595a850485 +Subproject commit 02bc2dc9bee96c0e7d93d23c6f0b7a24d0e17566 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 @@ -28,7 +28,7 @@ test: master.log newcache.log sed -n -e '2{' \ -e 's/.*Buckets = //' \ -e 's/\.$$//' \ - -e 'p}') * 2))} \ + -e 'p}') + 100))} \ --log-file=$*.log \ $(abs_top_builddir)/src/$*/fetchkeys clean: diff --git a/src/gnuplot.m4 b/src/gnuplot.m4 index 29126f5..392eb94 100644 --- a/src/gnuplot.m4 +++ b/src/gnuplot.m4 @@ -12,14 +12,14 @@ set style line 3 linecolor rgb "blue" linewidth 1.000 dashtype solid pointtype 1 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 @@ -16,14 +16,33 @@ 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++) { @@ -46,13 +65,9 @@ sub runtest { 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"; @@ -60,11 +75,7 @@ sub runtest { 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( -- cgit v1.2.1