interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / nodes / tests / measure.sh

59 lines · 2153 bytes Raw Blame History
1# ORACLE: host timing harness (sh + curl) for forged page time. Not product code; changes no server state.
2# nodes/tests/measure.sh OUTDIR URL: for each route, one warmup request, then 32 timed requests, under
3# X-Forge-Base / and then /forge/, two full passes. Writes OUTDIR/times.tsv
4# ("pass base route code bytes seconds") and OUTDIR/meta.txt (binary size, sha256, VmRSS/VmHWM of
5# the process listening on URL's port, before and after each pass). Docs: docs/PERF.md.
6set -eu
7OUT=${1:?outdir}
8ROOT=${2:?base url}
9N=32
10mkdir -p "$OUT"
11routes='
12/
13/explore
14/drakestapleton
15/drakestapleton/cuda-crack
16/drakestapleton/cuda-crack/tree/main
17/drakestapleton/cuda-crack/commits/main
18/drakestapleton/cuda-crack/blob/main/README.md
19/drakestapleton/cuda-crack/issues
20/drakestapleton/cuda-crack/patches
21/drakestapleton/cuda-crack/releases
22/login
23/search?q=omega
24/assets/forge.css
25'
26port=${ROOT##*:}
27pid=$(ss -Htlnp "sport = :$port" | grep -o 'pid=[0-9]*' | head -n 1 | cut -d= -f2 || true)
28{
29 echo "when $(date -u +%Y-%m-%dT%H:%M:%SZ)"
30 echo "root $ROOT"
31 echo "pid ${pid:-none}"
32 if [ -n "$pid" ] && [ -d "/proc/$pid" ]; then
33 exe=$(readlink -f "/proc/$pid/exe")
34 echo "exe $exe"
35 stat -c 'bytes %s' "$exe"
36 sha256sum "$exe"
37 awk '/VmRSS|VmHWM|VmSize/ {print}' "/proc/$pid/status"
38 fi
39} > "$OUT/meta.txt"
40: > "$OUT/times.tsv"
41for pass in 1 2; do
42 for base in / /forge/; do
43 if [ "$base" = / ]; then btag=root; else btag=forge; fi
44 for route in $routes; do
45 curl -sS -o /dev/null --max-time 60 -H "X-Forge-Base: $base" -H "X-Real-IP: 127.0.0.1" "$ROOT$route" || true
46 i=1
47 while [ "$i" -le "$N" ]; do
48 curl -sS -o /dev/null -w "$pass $btag $route %{http_code} %{size_download} %{time_total}\n" --max-time 60 \
49 -H "X-Forge-Base: $base" -H "X-Real-IP: 127.0.0.1" "$ROOT$route" >> "$OUT/times.tsv" || echo "$pass $btag $route 000 0 0" >> "$OUT/times.tsv"
50 i=$((i+1))
51 done
52 done
53 done
54 if [ -n "$pid" ] && [ -d "/proc/$pid" ]; then
55 echo "after pass $pass" >> "$OUT/meta.txt"
56 awk '/VmRSS|VmHWM/ {print}' "/proc/$pid/status" >> "$OUT/meta.txt"
57 fi
58done
59echo DONE >> "$OUT/meta.txt"