Repository navigation
Expand file tree
/
Copy pathcpu.sh
More file actions
executable file
·40 lines (37 loc) · 2.29 KB
/
Copy pathcpu.sh
File metadata and controls
executable file
·40 lines (37 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
# Decode CPU benchmark: wall-time vs capture duration (×-realtime)
# per mode on the bench fixtures. Higher is better; anything < 1.0
# cannot keep up live on this machine.
set -euo pipefail
cd "$(dirname "$0")/.."
XNG="${1:-target/release/xng}"
run() { # name file fmt mode rate center channels duration_s
local t0 t1 wall
t0=$(python3 -c 'import time; print(time.time())')
"$XNG" decode "$2" -f "$3" -m "$4" -r "$5" -c "$6" --channels "$7" >/dev/null 2>&1
t1=$(python3 -c 'import time; print(time.time())')
wall=$(python3 -c "print(f'{$t1-$t0:.2f}')")
python3 -c "print(f'{\"$1\":12} {$8:7.1f}s capture {$wall:>7}s wall {$8/$wall:6.1f}x realtime')"
}
echo "mode capture decode speed"
# modes1 is 0.18 s — loop it 20x so process startup doesn't dominate.
if [ ! -f /tmp/bench_modes1_x20.cu8 ]; then
for i in $(seq 20); do cat bench/data/modes1.cu8; done > /tmp/bench_modes1_x20.cu8
fi
run adsb /tmp/bench_modes1_x20.cu8 cu8 adsb 2000000 1090000000 1090 3.57
# ACARS: no vendored off-air fixture, so synthesize a multi-channel 2.4 MS/s
# capture (cf32) from the crate's modulator and loop it to a few seconds. The
# CPU cost is per *requested* channel (the DDC runs whether or not a burst is
# present), so decode it across 8 VHF ACARS channels — the realistic
# acarsdec-replacement load that the per-channel front end has to keep up with.
# Regenerate the fixture every run (cheap, ~0.5 s) so a change to gen_capture
# can never leave a stale /tmp capture skewing the comparison.
cargo run --release -q -p xng-mode-acars --example gen_capture -- /tmp/bench_acars_1x.cf32 >/dev/null 2>&1
for _ in $(seq 5); do cat /tmp/bench_acars_1x.cf32; done > /tmp/bench_acars_8ch.cf32
# gen_capture writes ~0.47 s at 2.4 MS/s; ×5 ≈ 2.36 s. 8 channels across the
# US ACARS plan around the 131.500 capture center.
run acars /tmp/bench_acars_8ch.cf32 cf32 acars 2400000 131500000 \
131.425,131.450,131.475,131.525,131.550,131.575,131.725,131.825 2.36
[ -f bench/data/ais_96k.cs16 ] && run ais bench/data/ais_96k.cs16 cs16 ais 96000 162000000 161.975,162.025 300
[ -f bench/data/vdl2_105k_conj.s16 ] && run vdl2 bench/data/vdl2_105k_conj.s16 cs16 vdl2 105000 136975000 136.975 46.9
[ -f bench/data/hfdl_48k.cs16 ] && run hfdl bench/data/hfdl_48k.cs16 cs16 hfdl 48000 21931000 21931k 127.3