Files
faumarayandClaude Opus 5.5 f9f95dbf0d spikes/gpui: the Slint app's logs stay out of the desktop's state directory
headless.sh and headless-wayland.sh set XDG_STATE_HOME to the run's state
directory as they set the other XDG directories: the Slint app (the
slint-720p30 case) keeps its log files there, and its runs had written
them to the desktop's ~/.local/state/voelin/logs.

measure.sh waits for the Slint app's window (up to 60 s; it took more than
20 s to appear on a busy machine, past the fixed 8 s the case waited) and
then measures it for the case's full length. The video README gives the
static cases and the Wayland run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 02:38:08 +03:00

93 lines
4.4 KiB
Bash
Executable File

#!/bin/sh
# Spike 1's measurements on the headless display, one case after another;
# every case writes <case>.jsonl (one line a second, then the summary) to
# $OUT. Cases (default: all, in this order):
#
# bench RGBA against BGRA conversion, no window
# static-1080p60 static-1440p60 one picture, repainted every frame (the control)
# raw-1080p60 raw-1440p60 frames from memory: conversion + GPUI only
# pipeline-1080p60 pipeline-1440p60 LocalPreview: capture, VP8, decoder (as Video::demo)
# pipeline-1440p60-rgba the same with voelin-media's RGBA conversion
# nodrop-1440p the negative control: no cx.drop_image (15 fps, 12 s)
# pipeline-720p30 GPUI with Video::demo's own settings (1280x720, 30 fps, 4.6 Mbit/s)
# slint-720p30 the Slint app's demo stream (VOELIN_DEMO_STREAM), same display
#
# spikes/gpui/shell.sh spikes/gpui/headless.sh -- spikes/gpui/video/measure.sh [CASE...]
#
# SECONDS_RUN (default 70) and WARMUP (default 10) set the length of the
# window cases. damage-count runs beside every window case: it counts the
# window's content changes from the X server's side.
set -eu
root=$(cd "$(dirname "$0")/../../.." && pwd)
out=${OUT:-$root/.scratch/gpui-spikes-results}
mkdir -p "$out"
out=$(cd "$out" && pwd)
bin=$root/target/release
seconds=${SECONDS_RUN:-70}
warmup=${WARMUP:-10}
cases=${*:-bench static-1080p60 static-1440p60 raw-1080p60 raw-1440p60 pipeline-1080p60 pipeline-1440p60 pipeline-1440p60-rgba nodrop-1440p pipeline-720p30 slint-720p30}
video() {
name=$1
shift
echo "== $name: spike-video $*" >&2
echo "load before: $(cat /proc/loadavg)" >"$out/$name.load"
"$bin/damage-count" spike-video "$((seconds - 1))" "$warmup" >"$out/$name-damage.jsonl" &
damage=$!
# A picture of the window during the warm-up (not averaged).
(sleep 5 && w=$(xdotool search --name '^spike-video$' | head -1) && xwd -id "$w" -silent | magick xwd:- -resize 50% "png:$out/$name.png") &
"$bin/spike-video" "$@" --out "$out/$name.jsonl" >/dev/null 2>"$out/$name.log"
wait "$damage" || true
echo "load after: $(cat /proc/loadavg)" >>"$out/$name.load"
tail -1 "$out/$name.jsonl"
tail -1 "$out/$name-damage.jsonl"
}
for c in $cases; do
case $c in
bench) "$bin/spike-video" --bench --iterations 300 | tee "$out/bench.jsonl" ;;
static-1080p60) video "$c" --mode static --size 1920x1080 --seconds "$seconds" --warmup "$warmup" ;;
static-1440p60) video "$c" --mode static --size 2560x1440 --seconds "$seconds" --warmup "$warmup" ;;
raw-1080p60) video "$c" --mode raw --size 1920x1080 --fps 60 --seconds "$seconds" --warmup "$warmup" ;;
raw-1440p60) video "$c" --mode raw --size 2560x1440 --fps 60 --seconds "$seconds" --warmup "$warmup" ;;
pipeline-1080p60) video "$c" --mode pipeline --size 1920x1080 --fps 60 --seconds "$seconds" --warmup "$warmup" ;;
pipeline-1440p60) video "$c" --mode pipeline --size 2560x1440 --fps 60 --seconds "$seconds" --warmup "$warmup" ;;
pipeline-1440p60-rgba)
video "$c" --mode pipeline --size 2560x1440 --fps 60 --convert rgba --seconds "$seconds" --warmup "$warmup"
;;
nodrop-1440p) video "$c" --mode pipeline --size 2560x1440 --fps 15 --no-drop --seconds 12 --warmup 2 ;;
pipeline-720p30)
video "$c" --mode pipeline --size 1280x720 --fps 30 --bitrate 4608 --seconds "$seconds" --warmup "$warmup"
;;
slint-720p30)
echo "== $c: voelin (Slint, software renderer) with VOELIN_DEMO_STREAM=1" >&2
echo "load before: $(cat /proc/loadavg)" >"$out/$c.load"
data=$out/slint-data
rm -rf "$data"
mkdir -p "$data"
SLINT_BACKEND=winit-software SLINT_DEBUG_PERFORMANCE=console,refresh_lazy \
VOELIN_DATA_DIR="$data" VOELIN_DEMO_STREAM=1 VOELIN_WINDOW_SIZE=1440x960 VOELIN_FFMPEG=0 \
"$bin/voelin" >"$out/$c.log" 2>&1 &
app=$!
# The app takes 20 s or more to open its window on a busy machine.
i=0
until w=$(xdotool search --name '^Voelin$' 2>/dev/null | head -1) && [ -n "$w" ]; do
i=$((i + 1))
[ $i -lt 600 ] || { echo "no Voelin window" >&2; kill "$app"; exit 1; }
sleep 0.1
done
"$bin/damage-count" Voelin "$((seconds - 1))" "$warmup" >"$out/$c-damage.jsonl" &
damage=$!
(sleep 5 && xwd -id "$w" -silent | magick xwd:- "png:$out/$c.png") &
"$bin/proc-meter" "$app" "$seconds" "$warmup" >"$out/$c.jsonl"
wait "$damage" || true
echo "load after: $(cat /proc/loadavg)" >>"$out/$c.load"
kill "$app" 2>/dev/null || true
wait "$app" 2>/dev/null || true
tail -1 "$out/$c.jsonl"
tail -1 "$out/$c-damage.jsonl"
;;
*) echo "unknown case $c" >&2; exit 2 ;;
esac
done