aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules4
-rw-r--r--Makefile.am4
-rwxr-xr-x[-rw-r--r--]bootstrap92
-rw-r--r--configure.ac5
m---------gdbm/master0
m---------gdbm/newcache0
-rw-r--r--src/Makefile.am2
-rw-r--r--src/benchmark.mk.in7
-rw-r--r--src/fetchkeys.c18
-rw-r--r--src/gnuplot.m426
-rw-r--r--src/master/Makefile.am2
-rw-r--r--src/newcache/Makefile.am5
-rwxr-xr-xsrc/runtest23
13 files changed, 145 insertions, 43 deletions
diff --git a/.gitmodules b/.gitmodules
index a4fd957..dfb9f90 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,5 +1 @@
-[submodule "gdbm/newcache"]
- path = gdbm/newcache
- url = git://git.gnu.org.ua/gdbm.git
- branch = newcache
[submodule "gdbm/master"]
diff --git a/Makefile.am b/Makefile.am
index 2020e06..db9b75f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,3 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = gdbm/master gdbm/newcache src
+SUBDIRS = @USER_SUBDIRS@ src
BENCHMARKDIR=benchmarks
@@ -13,3 +13,3 @@ benchmark:
fi; \
- DIRNAME="$(BENCHMARKDIR)/$(NRECS)-$(NKEYS)"; \
+ DIRNAME="$(BENCHMARKDIR)/$(BENCHMARKPREFIX)$(NRECS)-$(NKEYS)"; \
if ! test -d "$$DIRNAME"; then \
diff --git a/bootstrap b/bootstrap
index 1726aea..723788f 100644..100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,8 +1,86 @@
#!/bin/sh
-set e
-test -d m4 || mkdir m4
-test -d gdbm || mkdir gdbm
-git submodule init
-git submodule update
-git submodule foreach ./bootstrap
-autoreconf -f -i -s
+#! -*- perl -*-
+eval 'exec perl -x -S $0 ${1+"$@"}'
+ if 0;
+
+use strict;
+use warnings;
+use File::Basename;
+
+my %target;
+
+die "no bootstrap.conf in current working directory\n"
+ unless -f "bootstrap.conf";
+
+# Read configuration
+open(my $fh, '<', 'bootstrap.conf')
+ or die "can't open bootstrap.conf: $!\n";
+my $i = 0;
+while (<$fh>) {
+ chomp;
+ s/^\s+//;
+ s/#.*$//;
+ next if /^$/ ;
+ my ($treeish, $subdir) = split /\s+/;
+ if (!$subdir) {
+ $subdir = basename($treeish);
+ }
+
+ if ($subdir ne "master") {
+ unless (-d "gdbm/$subdir") {
+ system("git -C gdbm clone -b $treeish ./master $subdir");
+ }
+ }
+ system("(cd gdbm/$subdir; ./bootstrap)");
+
+ unless (-d "src/$subdir") {
+ mkdir "src/$subdir"
+ }
+ my $makefile = "src/$subdir/Makefile.am";
+ unless (-f $makefile) {
+ open(my $of, '>', $makefile)
+ or die "can't open $makefile for writing: $!\n";
+ print $of <<EOT;
+noinst_PROGRAMS=fetchkeys
+fetchkeys_SOURCES=fetchkeys.c
+VPATH=\$(top_srcdir)/src
+LDADD=../../gdbm/$subdir/src/.libs/libgdbm.a
+AM_CPPFLAGS=-DSIZEOF_OFF_T=8 -I\$(top_srcdir)/gdbm/$subdir/src/
+EOT
+ ;
+ close $of;
+ }
+ $target{$subdir} = {
+ order => $i,
+ treeish => $treeish
+ };
+ ++$i;
+}
+close($fh);
+
+#
+# Creating directories
+#
+unless (-d 'm4') {
+ mkdir 'm4'
+}
+unless (-d 'gdbm') {
+ mkdir 'gdbm'
+}
+
+system("git submodule init");
+system("git submodule update");
+
+#
+# Creating bootstrap.mk
+#
+my @k = sort { $target{$a}{order} <=> $target{$b}{order}} keys %target;
+my $gdbm_subdirs = join(' ', map { "gdbm/$_" } @k);
+open($fh, '>', 'bootstrap.mk')
+ or die "can't open bootstrap.mk: $!\n";
+print $fh "AC_SUBST([USER_SUBDIRS],['$gdbm_subdirs'])\n";
+print $fh "AC_SUBST([USER_TARGETS],['" . join(' ', @k) . "'])\n";
+print $fh "AC_CONFIG_SUBDIRS([$gdbm_subdirs])\n";
+print $fh "AC_CONFIG_FILES([" . join(' ', map { "src/$_/Makefile" } @k) . "])\n";
+close $fh;
+
diff --git a/configure.ac b/configure.ac
index 84f1957..3d7dcb7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,8 +10,5 @@ AM_INIT_AUTOMAKE([-Wall -Werror 1.11.5 foreign tar-ustar silent-rules])
AC_PROG_CC
-
-AC_CONFIG_SUBDIRS(gdbm/master gdbm/newcache)
+m4_include([bootstrap.mk])
AC_CONFIG_FILES([Makefile
src/Makefile
- src/master/Makefile
- src/newcache/Makefile
src/benchmark.mk])
diff --git a/gdbm/master b/gdbm/master
-Subproject 4fb2326a4ac0e6f45c21f7651b1c87317567fd8
+Subproject 2cb3428f11998e6f10a92a3963c245cbc8ed7cf
diff --git a/gdbm/newcache b/gdbm/newcache
deleted file mode 160000
-Subproject 274985d77bf2e69dec8d7eb90bd3f752f115f6e
diff --git a/src/Makefile.am b/src/Makefile.am
index c019df3..0e1b1b8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS=newcache master
+SUBDIRS=@USER_TARGETS@
EXTRA_DIST=fechkeys.c runtest gnuplot.m4 benchmark.mk.in
diff --git a/src/benchmark.mk.in b/src/benchmark.mk.in
index 43c605c..4b4f199 100644
--- a/src/benchmark.mk.in
+++ b/src/benchmark.mk.in
@@ -20,5 +20,7 @@ GDBMTOOL=$(MASTERDIR)/src/gdbmtool
TESTDIR=$(MASTERDIR)/tests
+USER_TARGETS=@USER_TARGETS@
+LOGS=$(patsubst %, %.log, $(USER_TARGETS))
all: test
-test: master.log newcache.log
+test: $(LOGS)
%.log: keys.txt a.gdbm
@@ -34,3 +36,3 @@ test: master.log newcache.log
clean:
- rm -f master.log newcache.log
+ rm -f $(LOGS)
allclean: clean
@@ -46,2 +48,3 @@ benchmark.gnuplot: $(abs_top_srcdir)/src/gnuplot.m4
m4 -DNRECS=$(NRECS) -DNKEYS=$(NKEYS) -DNUMSAMPLES=$(NUMSAMPLES) \
+ "-DTARGETS=$$(echo "@USER_TARGETS@" | sed -r 's/[[:space:]]+/,/g')" \
$(abs_top_srcdir)/src/gnuplot.m4 > benchmark.gnuplot
diff --git a/src/fetchkeys.c b/src/fetchkeys.c
index 694f4d9..cfc0371 100644
--- a/src/fetchkeys.c
+++ b/src/fetchkeys.c
@@ -201,3 +201,3 @@ main (int argc, char **argv)
- while ((i = getopt (argc, argv, "bc:t:nTpv")) != EOF)
+ while ((i = getopt (argc, argv, "bc:t:nTpVv")) != EOF)
{
@@ -228,2 +228,18 @@ main (int argc, char **argv)
break;
+
+ case 'V':
+ printf ("gdbm header version: %d.%d",
+ GDBM_VERSION_MAJOR, GDBM_VERSION_MINOR);
+#ifdef GDBM_VERSION_PATCH
+#if GDBM_VERSION_PATCH > 0
+ printf (".%d", GDBM_VERSION_PATCH);
+# endif
+#endif
+ putchar ('\n');
+ printf ("gdbm library version: %d.%d",
+ gdbm_version_number[0], gdbm_version_number[1]);
+ if (gdbm_version_number[2])
+ printf (".%d", gdbm_version_number[2]);
+ putchar ('\n');
+ exit (0);
diff --git a/src/gnuplot.m4 b/src/gnuplot.m4
index edee22e..411b86e 100644
--- a/src/gnuplot.m4
+++ b/src/gnuplot.m4
@@ -1,3 +1,14 @@
divert(-1)
-changequote([.])
+changequote([,])
+define([_PLOT],
+["$2.log" \
+ using 1:8:9:10 \
+ title "GDBM $2" with errorbars ls $1, \
+ "" using 1:8 \
+ notitle \
+ smooth bezier ls $1[]dnl
+ifelse([$3],,,[dnl
+,\
+ $0(eval(($1 % 3) + 1), shift(shift($*)))])])
+define([PLOT],[plot _PLOT(1, $*)])
divert(0)dnl
@@ -13,13 +24,2 @@ set style line 4 linecolor rgb "#0072b2" linewidth 1.000 dashtype solid pointtyp
-plot "master.log" \
- using 1:8:9:10 \
- title "GDBM 1.18.1" with errorbars ls 1, \
- "" using 1:8 \
- notitle \
- smooth bezier ls 2, \
- "newcache.log" \
- using 1:8:9:10 \
- title "GDBM newcache" with errorbars ls 3, \
- "" using 1:8 \
- notitle \
- smooth bezier ls 4
+PLOT(TARGETS)
diff --git a/src/master/Makefile.am b/src/master/Makefile.am
index c3adae5..8807411 100644
--- a/src/master/Makefile.am
+++ b/src/master/Makefile.am
@@ -4,2 +4,2 @@ VPATH=$(top_srcdir)/src
LDADD=../../gdbm/master/src/.libs/libgdbm.a
-AM_CPPFLAGS=-I$(top_srcdir)/gdbm/master/src/
+AM_CPPFLAGS=-DSIZEOF_OFF_T=8 -I$(top_srcdir)/gdbm/master/src/
diff --git a/src/newcache/Makefile.am b/src/newcache/Makefile.am
deleted file mode 100644
index a916d36..0000000
--- a/src/newcache/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-noinst_PROGRAMS=fetchkeys
-fetchkeys_SOURCES=fetchkeys.c
-VPATH=$(top_srcdir)/src
-LDADD=../../gdbm/newcache/src/.libs/libgdbm.a
-AM_CPPFLAGS=-I$(top_srcdir)/gdbm/newcache/src/
diff --git a/src/runtest b/src/runtest
index e11f7c7..0840e10 100755
--- a/src/runtest
+++ b/src/runtest
@@ -17,3 +17,4 @@ my $drop_caches; # Drop system disk caches before each run.
my $log_file; # Name of the log file.
-
+my $c_pow2; # Select power of 2 cache sizes
+
use constant {
@@ -46,2 +47,4 @@ sub runtest {
+#print "run ".join(' ',@_)."\n";
+#exit;
my $n;
@@ -85,2 +88,3 @@ GetOptions(
'final|end|e=n' => \$c_final,
+ '2' => \$c_pow2,
'drop-caches|d' => sub {
@@ -110,2 +114,14 @@ if ($c_step > $c_final - $c_init) {
+if ($c_pow2) {
+ $c_init = int(log($c_init) / log(2));
+ if ($c_init < 2) {
+ $c_init = 2;
+ }
+ my $f2 = int(log($c_final) / log(2));
+ if ((1 << $f2) < $c_final) {
+ $f2++;
+ }
+ $c_step = 1;
+}
+
if ($log_file) {
@@ -117,4 +133,5 @@ if ($log_file) {
for (my $c = $c_init; $c <= $c_final; $c += $c_step) {
- printf LOG "%d ", $c;
- foreach my $t (runtest(@ARGV, '-c', $c)) {
+ my $size = $c_pow2 ? (1 << $c) : $c;
+ printf LOG "%d ", $size;
+ foreach my $t (runtest(@ARGV, '-c', $size)) {
printf LOG " %.6f", $t;

Return to:

Send suggestions and report system problems to the System administrator.