Fix typos in session extension header comments. No changes to code.
[sqlite.git] / tool / speed-check.sh
blobf9efb7c13df1892cf962569c4f99061ed7c754f3
1 #!/bin/bash
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
11 # the first argument:
13 # summary-$BASE.txt # Copy of standard output
14 # cout-$BASE.txt # cachegrind output
15 # explain-$BASE.txt # EXPLAIN listings (only with --explain)
17 if test "$1" = ""
18 then
19 echo "Usage: $0 OUTPUTFILE [OPTIONS]"
20 exit
22 NAME=$1
23 shift
24 #CC_OPTS="-DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_MEMSYS5"
25 CC_OPTS="-DSQLITE_ENABLE_MEMSYS5"
26 CC=gcc
27 SPEEDTEST_OPTS="--shrink-memory --reprepare --stats --heap 10000000 64"
28 SIZE=5
29 LEAN_OPTS="-DSQLITE_THREADSAFE=0"
30 LEAN_OPTS="$LEAN_OPTS -DSQLITE_DEFAULT_MEMSTATUS=0"
31 LEAN_OPTS="$LEAN_OPTS -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1"
32 LEAN_OPTS="$LEAN_OPTS -DSQLITE_LIKE_DOESNT_MATCH_BLOB"
33 LEAN_OPTS="$LEAN_OPTS -DSQLITE_MAX_EXPR_DEPTH=0"
34 LEAN_OPTS="$LEAN_OPTS -DSQLITE_OMIT_DECLTYPE"
35 LEAN_OPTS="$LEAN_OPTS -DSQLITE_OMIT_DEPRECATED"
36 LEAN_OPTS="$LEAN_OPTS -DSQLITE_OMIT_PROGRESS_CALLBACK"
37 LEAN_OPTS="$LEAN_OPTS -DSQLITE_OMIT_SHARED_CACHE"
38 LEAN_OPTS="$LEAN_OPTS -DSQLITE_USE_ALLOCA"
39 doExplain=0
40 doCachegrind=1
41 while test "$1" != ""; do
42 case $1 in
43 --reprepare)
44 SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
46 --autovacuum)
47 SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
49 --utf16be)
50 SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
52 --stats)
53 SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
55 --without-rowid)
56 SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
58 --nomemstat)
59 SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
61 --temp)
62 SPEEDTEST_OPTS="$SPEEDTEST_OPTS --temp 6"
64 --wal)
65 SPEEDTEST_OPTS="$SPEEDTEST_OPTS --journal wal"
67 --size)
68 shift; SIZE=$1
70 --cachesize)
71 shift; SPEEDTEST_OPTS="$SPEEDTEST_OPTS --cachesize $1"
73 --explain)
74 doExplain=1
76 --vdbeprofile)
77 rm -f vdbe_profile.out
78 CC_OPTS="$CC_OPTS -DVDBE_PROFILE"
79 doCachegrind=0
81 --lean)
82 CC_OPTS="$CC_OPTS $LEAN_OPTS"
84 --clang)
85 CC=clang
87 --icc)
88 CC=/home/drh/intel/bin/icc
90 --gcc7)
91 CC=gcc-7
93 --heap)
94 CC_OPTS="$CC_OPTS -DSQLITE_ENABLE_MEMSYS5"
95 shift;
96 SPEEDTEST_OPTS="$SPEEDTEST_OPTS --heap $1 64"
98 --lookaside)
99 shift;
100 SPEEDTEST_OPTS="$SPEEDTEST_OPTS --lookaside $1 $2"
101 shift;
103 --repeat)
104 CC_OPTS="$CC_OPTS -DSQLITE_ENABLE_RCACHE"
105 shift;
106 SPEEDTEST_OPTS="$SPEEDTEST_OPTS --repeat $1"
108 --mmap)
109 shift;
110 SPEEDTEST_OPTS="$SPEEDTEST_OPTS --mmap $1"
112 --rtree)
113 SPEEDTEST_OPTS="$SPEEDTEST_OPTS --testset rtree"
114 CC_OPTS="$CC_OPTS -DSQLITE_ENABLE_RTREE"
116 --orm)
117 SPEEDTEST_OPTS="$SPEEDTEST_OPTS --testset orm"
120 CC_OPTS="$CC_OPTS $1"
122 esac
123 shift
124 done
125 SPEEDTEST_OPTS="$SPEEDTEST_OPTS --size $SIZE"
126 echo "NAME = $NAME" | tee summary-$NAME.txt
127 echo "SPEEDTEST_OPTS = $SPEEDTEST_OPTS" | tee -a summary-$NAME.txt
128 echo "CC_OPTS = $CC_OPTS" | tee -a summary-$NAME.txt
129 rm -f cachegrind.out.* speedtest1 speedtest1.db sqlite3.o
130 $CC -g -Os -Wall -I. $CC_OPTS -c sqlite3.c
131 size sqlite3.o | tee -a summary-$NAME.txt
132 if test $doExplain -eq 1; then
133 $CC -g -Os -Wall -I. $CC_OPTS \
134 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
135 ./shell.c ./sqlite3.c -o sqlite3 -ldl -lpthread
137 SRC=./speedtest1.c
138 $CC -g -Os -Wall -I. $CC_OPTS $SRC ./sqlite3.o -o speedtest1 -ldl -lpthread
139 ls -l speedtest1 | tee -a summary-$NAME.txt
140 if test $doCachegrind -eq 1; then
141 valgrind --tool=cachegrind ./speedtest1 speedtest1.db \
142 $SPEEDTEST_OPTS 2>&1 | tee -a summary-$NAME.txt
143 else
144 ./speedtest1 speedtest1.db $SPEEDTEST_OPTS 2>&1 | tee -a summary-$NAME.txt
146 size sqlite3.o | tee -a summary-$NAME.txt
147 wc sqlite3.c
148 if test $doCachegrind -eq 1; then
149 cg_anno.tcl cachegrind.out.* >cout-$NAME.txt
150 echo '*****************************************************' >>cout-$NAME.txt
151 sed 's/^[0-9=-]\{9\}/==00000==/' summary-$NAME.txt >>cout-$NAME.txt
153 if test $doExplain -eq 1; then
154 ./speedtest1 --explain $SPEEDTEST_OPTS | ./sqlite3 >explain-$NAME.txt
156 if test "$NAME" != "trunk"; then
157 fossil test-diff --tk -c 20 cout-trunk.txt cout-$NAME.txt