#!/bin/sh # Spike 1's measurements on the headless display, one case after another; # every case writes .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=$! "$bin/damage-count" Voelin "$((seconds - 1))" "$warmup" >"$out/$c-damage.jsonl" & damage=$! sleep 8 w=$(xdotool search --name '^Voelin$' | head -1) xwd -id "$w" -silent | magick xwd:- "png:$out/$c.png" "$bin/proc-meter" "$app" "$((seconds - 8))" "$((warmup > 8 ? warmup - 8 : 1))" >"$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