File size: 1,319 Bytes
cf6b956
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Build the SQLite trace workload from the official amalgamation.
#
#   SQLite 3.53.4, source id
#   2026-07-24 19:02:57 bf7c7f30031888f4e796e429ab3978879485813aaca6f641c7b33e4e09459bcc
#   https://www.sqlite.org/2026/sqlite-amalgamation-3530400.zip
#
# -no-pie is used so runtime PCs in the trace equal link-time addresses, which
# makes mapping trace PCs back to functions/source straightforward (modules.log
# still records the mapping for every module).
set -euo pipefail

AMALG=${1:-/work/src/sqlite-amalgamation-3530400}
OUT=${2:-/work/bin}

CFLAGS="-O2 -g -fno-omit-frame-pointer -no-pie -fno-pie \
 -DSQLITE_THREADSAFE=0 \
 -DSQLITE_OMIT_LOAD_EXTENSION \
 -DSQLITE_DEFAULT_MEMSTATUS=0 \
 -DSQLITE_MAX_MMAP_SIZE=4294967296"

mkdir -p "$OUT"
gcc $CFLAGS -c "$AMALG/sqlite3.c" -o "$OUT/sqlite3.o"
gcc $CFLAGS -I"$AMALG" /work/src/sqlite_setup.c "$OUT/sqlite3.o" \
    -o "$OUT/sqlite_setup" -lm -lpthread -ldl
gcc $CFLAGS -I"$AMALG" /work/src/sqlite_query.c "$OUT/sqlite3.o" \
    -o "$OUT/sqlite_query" -lm -lpthread -ldl

# Phase 1+2 (excluded from all traces): build the database and load the dataset.
#   $OUT/sqlite_setup /work/db/records.db 3000000
# Phase 3 (the only phase that is traced): steady-state query execution.
#   $OUT/sqlite_query /work/db/records.db 3 60000 50000 4900 5000 3000000