#!/bin/bash # Citable-grade paired timing of the zstd decompression context reuse in v9: # v9n zstd master 0f3b42ce806 + v9-0001..0004, reuse undone (control) # v9 zstd master 0f3b42ce806 + v9-0001..0004, as posted # One round = both builds back to back (order alternating with the round number), each # running bench.sh on 4 kB and 32 kB values of all three corpora and on 1 MB random values. # The integrity sentinel (calib) runs before and after every round; a round where either # reading is more than TOL% over the lane's idle floor is kept in the file but marked # clean=0, and analysis uses clean=1 rounds only. Rounds go in chunks so that no single # call runs for more than a few minutes; FIRST is the number of the first round of the chunk. # bash run_v9_cite.sh OUT FIRST COUNT (pinned to the measuring CPUs) # then: python3 cite_v9.py OUT_A [OUT_B] set -u A=$(cd "$(dirname "$0")" && pwd) # Our lab harness supplied the two functions below: integrity_calib_us timed a # fixed CPU-bound loop on the given CPUs, and integrity_ref_get gave the lane's # idle floor. They only mark a round clean=0/1; all 38 rounds were clean and # none was dropped, so stubbing them out changes no number. integrity_calib_us() { echo 0; } integrity_ref_get() { echo 0; } export W=${W:?directory holding the installs i-v9 and i-v9n} OUT=$1 FIRST=$2 COUNT=$3 TOL=${TOL:-8} LANE=${LANE:-a} CPUS=$(grep Cpus_allowed_list /proc/self/status | cut -f2) REF=$(integrity_ref_get "$LANE"); REF=${REF:-0} echo "# chunk $(date -Is) rounds $FIRST..$((FIRST + COUNT - 1)), cpus $CPUS, profile $(cat /sys/firmware/acpi/platform_profile 2>/dev/null), idle floor ${REF}us, tol ${TOL}%, zstd $(pkg-config --modversion libzstd)" >> $OUT RUNS=(v9n v9) for round in $(seq $FIRST $((FIRST + COUNT - 1))); do order=("${RUNS[@]}") (( round % 2 == 0 )) && order=("${RUNS[1]}" "${RUNS[0]}") pre=$(integrity_calib_us "$CPUS"); load=$(cut -d" " -f1-3 /proc/loadavg) tmp=$(mktemp) for b in "${order[@]}"; do bash $A/bench.sh $b zstd "4000 32000" 2>&1 | grep -E "^build=|ERROR" >> $tmp CORPORA=random bash $A/bench.sh $b zstd 1000000 2>&1 | grep -E "^build=|ERROR" >> $tmp done post=$(integrity_calib_us "$CPUS") ref=$REF; [ "$ref" -gt 0 ] || ref=$pre for v in $pre $post; do [ "$v" -gt 0 ] && [ "$v" -lt "$ref" ] && ref=$v; done limit=$(( ref + ref * TOL / 100 )) clean=1; { [ "$pre" -gt "$limit" ] || [ "$post" -gt "$limit" ]; } && clean=0 grep -q ERROR $tmp && clean=0 echo "# round $round order ${order[*]} calib ${pre}/${post}us floor ${ref}us clean=$clean load $load" >> $OUT sed "s/\$/ round=$round clean=$clean/" $tmp >> $OUT rm -f $tmp echo "round $round clean=$clean calib ${pre}/${post}us" done