omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / tools / argus / r8_wall_ab.sh
| 1 | #!/bin/bash |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # R8 wall clock, interleaved configurations (speed2). Each config is NAME=DIR:CONSUMER, where |
| 18 | # DIR holds rx_r8_aegis_test and CONSUMER is none|discard|ingest, optionally @CPULIST to pin the |
| 19 | # consumer thread (RX_ARGUS_CONSUMER_CPU), e.g. ingest@2. The order within a round |
| 20 | # rotates by round so no config always runs first. Timer: date +%s%N around the taskset'd |
| 21 | # process (us resolution; includes the same exec overhead for every config). |
| 22 | # Usage: r8_wall_ab.sh CPUS ROUNDS NAME=DIR:CONSUMER ... > out.jsonl (under the bench flock) |
| 23 | set -u |
| 24 | CPUS=$1; ROUNDS=$2; shift 2 |
| 25 | cfgs=("$@"); n=${#cfgs[@]} |
| 26 | for r in $(seq 1 "$ROUNDS"); do |
| 27 | for j in $(seq 0 $((n - 1))); do |
| 28 | c=${cfgs[$(( (j + r) % n ))]}; name=${c%%=*}; rest=${c#*=}; dir=${rest%%:*}; mode=${rest#*:} |
| 29 | pin=""; case $mode in *@*) pin=${mode#*@}; mode=${mode%%@*};; esac |
| 30 | if [ "$mode" = none ]; then env=(); else env=(RX_ARGUS_CONSUMER="$mode"); fi |
| 31 | [ -n "$pin" ] && env+=(RX_ARGUS_CONSUMER_CPU="$pin") |
| 32 | log=$(mktemp -p "${TMPDIR_BENCH:-.}") |
| 33 | t0=$(date +%s%N); env "${env[@]}" taskset -c "$CPUS" "$dir/rx_r8_aegis_test" >"$log" 2>&1; rc=$?; t1=$(date +%s%N) |
| 34 | pass=$(grep -q "failures 0" "$log" && echo true || echo false) |
| 35 | printf '{"cfg":"%s","round":%d,"cpus":"%s","load1":%s,"wall_us":%d,"rc":%d,"passed":%s}\n' \ |
| 36 | "$name" "$r" "$CPUS" "$(cut -d' ' -f1 /proc/loadavg)" $(( (t1 - t0) / 1000 )) "$rc" "$pass" |
| 37 | rm -f "$log" |
| 38 | done |
| 39 | done |