diff --git a/src/test/bench/Makefile b/src/test/bench/Makefile index 39eca668678..1a506d5afd0 100644 --- a/src/test/bench/Makefile +++ b/src/test/bench/Makefile @@ -3,11 +3,12 @@ # Makefile-- # Makefile for the Wisconsin Benchmark # -# Copyright (c) 1994-5, Regents of the University of California +# Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group +# Portions Copyright (c) 1994-5, Regents of the University of California # # # IDENTIFICATION -# $PostgreSQL: pgsql/src/test/bench/Makefile,v 1.10 2003/11/29 19:52:14 pgsql Exp $ +# $PostgreSQL: pgsql/src/test/bench/Makefile,v 1.11 2004/09/01 17:25:40 tgl Exp $ # #------------------------------------------------------------------------- @@ -18,23 +19,14 @@ include $(top_builddir)/src/Makefile.global CREATEFILES= create.sql bench.sql OUTFILES= bench.out bench.out.perquery -override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) -override CFLAGS += $(CFLAGS_SL) - all: $(CREATEFILES) rm -f $(OUTFILES) create.sql: create.source - if [ -z "$$USER" ]; then USER=$$LOGNAME; fi; \ - if [ -z "$$USER" ]; then USER=`whoami`; fi; \ - if [ -z "$$USER" ]; then echo 'Cannot deduce $$USER.'; exit 1; fi; \ rm -f $@; \ C=`pwd`; \ - sed -e "s:_CWD_:$$C:g" \ - -e "s:_OBJWD_:$$C:g" \ - -e "s:_SLSUFF_:$(SLSUFF):g" \ - -e "s/_USER_/$$USER/g" < $< > $@ + sed -e "s:_CWD_:$$C:g" < $< > $@ bench.sql: x=1; \ @@ -48,13 +40,12 @@ runtest: $(OUTFILES) bench.out: $(CREATEFILES) $(SHELL) ./create.sh $$PGDATA && \ - $(SHELL) ./runwisc.sh $$PGDATA >bench.out 2>&1 + $(SHELL) ./runwisc.sh $$PGDATA > $@ @echo "RESULTS OF BENCHMARK ARE SAVED IN FILE bench.out"; bench.out.perquery: bench.out - $(SHELL) ./perquery &1 > $@ - @echo "BREAKDOWN OF BENCHMARK IS SAVED IN FILE" \ - "bench.out.perquery"; + $(SHELL) ./perquery $@ + @echo "BREAKDOWN OF BENCHMARK IS SAVED IN FILE bench.out.perquery"; clean: rm -f $(OUTFILES) $(CREATEFILES) diff --git a/src/test/bench/WISC-README b/src/test/bench/WISC-README index 7142802f927..f838dd3fa5a 100644 --- a/src/test/bench/WISC-README +++ b/src/test/bench/WISC-README @@ -1,5 +1,13 @@ The Postgres Wisconsin Benchmark +The short form of the directions below: + + ensure postmaster is stopped + export PGDATA=/wherever + make runtest + +The long form: + In this directory are the queries and raw data files used to populate the Postgres version of the Wisconsin benchmark. In order to run the benchmark, you'll initially need to execute the script diff --git a/src/test/bench/create.sh b/src/test/bench/create.sh index 8a7a3da4a9a..77c08368303 100755 --- a/src/test/bench/create.sh +++ b/src/test/bench/create.sh @@ -1,8 +1,8 @@ #!/bin/sh -# $PostgreSQL: pgsql/src/test/bench/create.sh,v 1.3 2003/11/29 19:52:14 pgsql Exp $ +# $PostgreSQL: pgsql/src/test/bench/create.sh,v 1.4 2004/09/01 17:25:40 tgl Exp $ # if [ ! -d $1 ]; then - echo " you must specify a valid data directory " + echo " you must specify a valid data directory " >&2 exit fi if [ -d ./obj ]; then @@ -19,7 +19,7 @@ if [ $? -ne 0 ]; then exit 1 fi -postgres -D${1} -Q bench < create.sql > /dev/null +postgres -D${1} bench < create.sql > /dev/null if [ $? -ne 0 ]; then echo initial database load failed exit 1 diff --git a/src/test/bench/perquery b/src/test/bench/perquery index 4f0ba03ce61..e6f5c43c304 100644 --- a/src/test/bench/perquery +++ b/src/test/bench/perquery @@ -1,12 +1,9 @@ #!/bin/sh -egrep 'x = "|elapse' > /tmp/foo$$ - +egrep 'x = "|elapse' | \ awk 'BEGIN { x = 0; y = 0; z = 0; a = 0; } \ /.*elapse.*/ {x = $2 + x; y = $4 + y; z = $6 + z;} \ /.*x = ".*/ { \ printf "query %2d: %7.3f real %7.3f user %7.3f sys\n", a, x, y, z; \ x = 0; y = 0; z = 0; a = a + 1; } \ - END {printf("query %2d: %7.3f real %7.3f user %7.3f sys\n", a, x, y, z);}' \ - < /tmp/foo$$ - + END {printf("query %2d: %7.3f real %7.3f user %7.3f sys\n", a, x, y, z);}' diff --git a/src/test/bench/runwisc.sh b/src/test/bench/runwisc.sh index 642edd3f0d2..690f0088062 100755 --- a/src/test/bench/runwisc.sh +++ b/src/test/bench/runwisc.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $PostgreSQL: pgsql/src/test/bench/runwisc.sh,v 1.5 2003/11/29 19:52:14 pgsql Exp $ +# $PostgreSQL: pgsql/src/test/bench/runwisc.sh,v 1.6 2004/09/01 17:25:40 tgl Exp $ # # Note that in our published benchmark numbers, we executed the command in the # following fashion: @@ -7,7 +7,7 @@ # time $POSTGRES -texecutor -tplanner -f hashjoin -Q bench # if [ ! -d $1 ]; then - echo " you must specify a valid data directory " + echo " you must specify a valid data directory " >&2 exit fi @@ -15,8 +15,8 @@ if [ -d ./obj ]; then cd ./obj fi -echo =============== vacuuming benchmark database... ================= -echo "vacuum" | postgres -D${1} -Q bench > /dev/null +echo =============== vacuuming benchmark database... ================= >&2 +echo "vacuum" | postgres -D${1} bench > /dev/null -echo =============== running benchmark... ================= -time postgres -D${1} -texecutor -tplanner -Q bench < bench.sql +echo =============== running benchmark... ================= >&2 +time postgres -D${1} -texecutor -tplanner -c log_min_messages=log -c log_destination=stderr -c redirect_stderr=off bench < bench.sql 2>&1