Skip to main content

max / shop

2.3 KB · 66 lines History Blame Raw
1 // vtebench-driven cell path workloads. On fw13 these shell out to the
2 // vtebench binary (https://github.com/alacritty/vtebench) and time shop's
3 // consumption of the corpus. The runner spawns shop, pipes the corpus to its
4 // stdin (or through the PTY primary once shop-bench can drive one), and
5 // samples PTY-drain throughput + wl-presentation-time frame stamps.
6
7 use anyhow::{Result, bail};
8
9 use super::{Workload, WorkloadResult};
10
11 pub(crate) struct Cat;
12 pub(crate) struct Scrolling;
13 pub(crate) struct Unicode;
14
15 impl Workload for Cat {
16 fn name(&self) -> &'static str {
17 "vtebench-cat"
18 }
19 fn description(&self) -> &'static str {
20 "vtebench --dat cat: raw byte throughput, hot cell path"
21 }
22 fn run(&self) -> Result<WorkloadResult> {
23 run_vtebench("cat", &["cell_throughput_mb_s", "frame_time_p99_ms"])
24 }
25 }
26
27 impl Workload for Scrolling {
28 fn name(&self) -> &'static str {
29 "vtebench-scrolling"
30 }
31 fn description(&self) -> &'static str {
32 "vtebench --dat scrolling: scroll+render frame time"
33 }
34 fn run(&self) -> Result<WorkloadResult> {
35 run_vtebench("scrolling", &["frame_time_p99_ms", "frame_time_p50_ms"])
36 }
37 }
38
39 impl Workload for Unicode {
40 fn name(&self) -> &'static str {
41 "vtebench-unicode"
42 }
43 fn description(&self) -> &'static str {
44 "vtebench --dat unicode: grapheme + width fast path"
45 }
46 fn run(&self) -> Result<WorkloadResult> {
47 run_vtebench("unicode", &["cell_throughput_mb_s"])
48 }
49 }
50
51 fn run_vtebench(_dat: &str, _metrics: &[&str]) -> Result<WorkloadResult> {
52 // fw13-only wiring lives here. Steps:
53 // 1. Resolve the vtebench binary (env SHOP_BENCH_VTEBENCH or PATH).
54 // 2. Spawn shop under a headless-Wayland fixture (weston --backend=headless
55 // or sway --no-outputs, TBD; see docs/typed-protocol.md phase 0).
56 // 3. Open a PTY, launch `vtebench --dat <_dat>` inside shop, and time
57 // the read-drain via a wrapper shell that timestamps EOF.
58 // 4. Sample presentation-time timestamps from shop via a debug socket
59 // (added under `--feature bench-hooks` on the shop binary).
60 // 5. Emit each name in `_metrics` as an f64.
61 bail!(
62 "vtebench workloads are fw13-only and not yet wired; \
63 see crates/shop-bench/src/workloads/vtebench.rs for the checklist"
64 )
65 }
66