3 # This is a template for a script used for day-to-day size and
4 # performance monitoring of SQLite. Typical usage:
6 # sh run-speed-test.sh trunk # Baseline measurement of trunk
7 # sh run-speed-test.sh x1 # Measure some experimental change
8 # fossil test-diff --tk cout-trunk.txt cout-x1.txt # View chanages
10 # There are multiple output files, all with a base name given by
13 # summary-$BASE.txt # Copy of standard output
14 # cout-$BASE.txt # cachegrind output
15 # explain-$BASE.txt # EXPLAIN listings (only with --explain)
19 echo "Usage: $0 OUTPUTFILE [OPTIONS]"
24 CC_OPTS
="-DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_MEMSYS5"
25 SPEEDTEST_OPTS
="--shrink-memory --reprepare --heap 10000000 64"
28 while test "$1" != ""; do
31 SPEEDTEST_OPTS
="$SPEEDTEST_OPTS $1"
34 SPEEDTEST_OPTS
="$SPEEDTEST_OPTS $1"
37 SPEEDTEST_OPTS
="$SPEEDTEST_OPTS $1"
40 SPEEDTEST_OPTS
="$SPEEDTEST_OPTS $1"
43 SPEEDTEST_OPTS
="$SPEEDTEST_OPTS $1"
46 SPEEDTEST_OPTS
="$SPEEDTEST_OPTS $1"
49 SPEEDTEST_OPTS
="$SPEEDTEST_OPTS --journal wal"
58 CC_OPTS
="$CC_OPTS -DSQLITE_ENABLE_MEMSYS5"
60 SPEEDTEST_OPTS
="$SPEEDTEST_OPTS --heap $1 64"
68 SPEEDTEST_OPTS
="$SPEEDTEST_OPTS --size $SIZE"
69 echo "NAME = $NAME" |
tee summary-
$NAME.txt
70 echo "SPEEDTEST_OPTS = $SPEEDTEST_OPTS" |
tee -a summary-
$NAME.txt
71 echo "CC_OPTS = $CC_OPTS" |
tee -a summary-
$NAME.txt
72 rm -f cachegrind.out.
* speedtest1 speedtest1.db sqlite3.o
73 gcc
-g -Os -Wall -I.
$CC_OPTS -c sqlite3.c
74 size sqlite3.o |
tee -a summary-
$NAME.txt
75 if test $doExplain -eq 1; then
76 gcc
-g -Os -Wall -I.
$CC_OPTS \
77 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
78 .
/shell.c .
/sqlite3.c
-o sqlite3
-ldl -lpthread
81 gcc
-g -Os -Wall -I.
$CC_OPTS $SRC .
/sqlite3.o
-o speedtest1
-ldl -lpthread
82 ls -l speedtest1 |
tee -a summary-
$NAME.txt
83 valgrind
--tool=cachegrind .
/speedtest1 speedtest1.db \
84 $SPEEDTEST_OPTS 2>&1 |
tee -a summary-
$NAME.txt
85 size sqlite3.o |
tee -a summary-
$NAME.txt
87 cg_anno.tcl cachegrind.out.
* >cout-
$NAME.txt
88 if test $doExplain -eq 1; then
89 .
/speedtest1
--explain $SPEEDTEST_OPTS | .
/sqlite3
>explain-
$NAME.txt