Enable API armor handling for the new deserialize APIs.
[sqlite.git] / tool / run-speed-test.sh
blob0e970ea0f6022ee17ee78982836d7955fdf54d25
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 SPEEDTEST_OPTS="--shrink-memory --reprepare --heap 10000000 64"
26 SIZE=5
27 doExplain=0
28 while test "$1" != ""; do
29 case $1 in
30 --reprepare)
31 SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
33 --autovacuum)
34 SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
36 --utf16be)
37 SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
39 --stats)
40 SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
42 --without-rowid)
43 SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
45 --nomemstat)
46 SPEEDTEST_OPTS="$SPEEDTEST_OPTS $1"
48 --wal)
49 SPEEDTEST_OPTS="$SPEEDTEST_OPTS --journal wal"
51 --size)
52 shift; SIZE=$1
54 --explain)
55 doExplain=1
57 --heap)
58 CC_OPTS="$CC_OPTS -DSQLITE_ENABLE_MEMSYS5"
59 shift;
60 SPEEDTEST_OPTS="$SPEEDTEST_OPTS --heap $1 64"
63 CC_OPTS="$CC_OPTS $1"
65 esac
66 shift
67 done
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
80 SRC=./speedtest1.c
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
86 wc sqlite3.c
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