kvtest-speed.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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. if test "$1" = ""
  10. then
  11. echo "Usage: $0 OUTPUTFILE [OPTIONS]"
  12. exit
  13. fi
  14. NAME=$1
  15. shift
  16. OPTS="-DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DIRECT_OVERFLOW_READ -DUSE_PREAD"
  17. KVARGS="--count 100K --stats"
  18. gcc -g -Os -I. $OPTS $* kvtest.c sqlite3.c -o kvtest
  19. # First run using SQL
  20. rm cachegrind.out.[1-9][0-9]*
  21. valgrind --tool=cachegrind ./kvtest run kvtest.db $KVARGS 2>&1 | tee summary-kvtest-$NAME.txt
  22. mv cachegrind.out.[1-9][0-9]* cachegrind.out.sql-$NAME
  23. cg_anno.tcl cachegrind.out.sql-$NAME >cout-kvtest-sql-$NAME.txt
  24. # Second run using the sqlite3_blob object
  25. valgrind --tool=cachegrind ./kvtest run kvtest.db $KVARGS --blob-api 2>&1 | tee -a summary-kvtest-$NAME.txt
  26. mv cachegrind.out.[1-9][0-9]* cachegrind.out.$NAME
  27. cg_anno.tcl cachegrind.out.$NAME >cout-kvtest-$NAME.txt
  28. # Diff the sqlite3_blob API analysis for non-trunk runs.
  29. if test "$NAME" != "trunk"; then
  30. fossil test-diff --tk cout-kvtest-trunk.txt cout-kvtest-$NAME.txt &
  31. fi