drh | 9dc7ad1 | 2017-01-31 15:29:05 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # A script for running speed tests using kvtest. |
| 4 | # |
| 5 | # The test database must be set up first. Recommended |
| 6 | # command-line: |
| 7 | # |
| 8 | # ./kvtest init kvtest.db --count 100K --size 12K --variance 5K |
| 9 | |
| 10 | if test "$1" = "" |
| 11 | then |
| 12 | echo "Usage: $0 OUTPUTFILE [OPTIONS]" |
| 13 | exit |
| 14 | fi |
| 15 | NAME=$1 |
| 16 | shift |
| 17 | OPTS="-DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DIRECT_OVERFLOW_READ -DUSE_PREAD" |
| 18 | KVARGS="--count 100K --stats" |
| 19 | gcc -g -Os -I. $OPTS $* kvtest.c sqlite3.c -o kvtest |
| 20 | |
| 21 | # First run using SQL |
| 22 | rm cachegrind.out.[1-9][0-9]* |
| 23 | valgrind --tool=cachegrind ./kvtest run kvtest.db $KVARGS 2>&1 | tee summary-kvtest-$NAME.txt |
drh | 0caad09 | 2017-01-31 16:49:01 +0000 | [diff] [blame] | 24 | mv cachegrind.out.[1-9][0-9]* cachegrind.out.sql-$NAME |
| 25 | cg_anno.tcl cachegrind.out.sql-$NAME >cout-kvtest-sql-$NAME.txt |
drh | 9dc7ad1 | 2017-01-31 15:29:05 +0000 | [diff] [blame] | 26 | |
| 27 | # Second run using the sqlite3_blob object |
drh | 9dc7ad1 | 2017-01-31 15:29:05 +0000 | [diff] [blame] | 28 | valgrind --tool=cachegrind ./kvtest run kvtest.db $KVARGS --blob-api 2>&1 | tee -a summary-kvtest-$NAME.txt |
| 29 | mv cachegrind.out.[1-9][0-9]* cachegrind.out.$NAME |
| 30 | cg_anno.tcl cachegrind.out.$NAME >cout-kvtest-$NAME.txt |
| 31 | |
| 32 | # Diff the sqlite3_blob API analysis for non-trunk runs. |
| 33 | if test "$NAME" != "trunk"; then |
| 34 | fossil test-diff --tk cout-kvtest-trunk.txt cout-kvtest-$NAME.txt & |
| 35 | fi |