# brintos-perfbench baseline runner: `sh /usr/libexec/brintos-perfbench/run`. # # Not run through brintos-selftest: that runner backgrounds each suite under a # watchdog that execs `sleep 1` every second, and on this runtime a spawn is # expensive enough to show up in every figure below. Everything here runs in the # foreground, and this script speaks the same BST protocol so both verify # drivers can drive it with --runner. Arguments are ignored (the drivers append # suite selectors). # # Output: one `PERF n= variant=` line per # figure, `PERF-NOTE` lines for context, and one BST case per benchmark run. # # Exec cold and warm come FIRST: cold is the first exec of that file in this # boot, so nothing before it may run `nop` or curl. P=/usr/libexec/brintos-perfbench pass=0; fail=0; ids= # BRINTOS-WORKAROUND: brintos/linux-in-the-browser#177 remove -- the console drops one line written after the shell waits on a foreground child. # A sacrificial line follows every child, before anything that matters. prime() { printf 'PERF-PRIME\n'; } case_run() { _id=$1; shift "$@" _rc=$? prime ids="$ids perfbench/$_id" if [ "$_rc" = 0 ]; then pass=$((pass + 1)); printf 'BST ok perfbench/%s\n' "$_id" else fail=$((fail + 1)); printf 'BST not ok perfbench/%s : rc=%s: %s\n' "$_id" "$_rc" "$*" fi } printf '==BST-BEGIN==\n' read -r up0 _ < /proc/uptime printf 'PERF boot_uptime_at_suite %s s n=1 variant=guest\n' "$up0" init_line=$(dmesg 2>/dev/null | grep -m1 'Run .* as init process') prime case "$init_line" in \[*\]*) t=${init_line#\[}; t=${t%%\]*}; t=${t#"${t%%[! ]*}"} printf 'PERF boot_kernel_to_init %s s n=1 variant=guest\n' "$t" ;; *) printf 'PERF-NOTE no timestamped init line in dmesg: %s\n' "$init_line" ;; esac case_run exec-nop "$P/perfbench" exec nop 11 "$P/nop" case_run exec-curl "$P/perfbench" exec curl 6 /usr/bin/curl --version for v in perfbench perfbench-static perfbench-sc perfbench-sc-nodefer; do case_run "calls-$v" "$P/$v" calls case_run "malloc-$v" "$P/$v" malloc done case_run syscall "$P/perfbench" syscall case_run wake "$P/perfbench" wake case_run fork "$P/perfbench" fork uname_r=$(uname -r) prime printf 'PERF-NOTE kernel %s\n' "$uname_r" for f in "$P/perfbench" "$P/perfbench-static" "$P/perfbench-sc" "$P/perfbench-sc-nodefer" "$P/nop" /usr/bin/curl; do sz=$(wc -c "$f") prime printf 'PERF-NOTE size %s\n' "$sz" done read -r up1 _ < /proc/uptime total=$((pass + fail)) printf '==BST-IDS perfbench%s==\n' "$ids" printf '==BST-SUITE perfbench elapsed=%ss bound=1800s cases=%s==\n' "$(( ${up1%.*} - ${up0%.*} ))" "$total" printf '==BST-SUMMARY pass=%s fail=%s skip=0 total=%s==\n' "$pass" "$fail" "$total" printf '==BST-END==\n'