Files
felhom.eu/documentation/audits/night-2026-10-22/P4-R1214/r1214run.sh
T

10 lines
935 B
Bash

#!/bin/bash
# r1214run.sh LABEL CMD... — runs on demo-hp: samples 9202's cgroup every 2 s while CMD runs (in 9202), prints a summary
L=$1; shift; CG=/sys/fs/cgroup/lxc/9202; OUT=/tmp/r1214-$L.tsv; : > $OUT
( while :; do echo -e "$(date -u +%T)\t$(sed -n 2p $CG/memory.pressure)\t$(grep -E '^(anon|file) ' $CG/memory.stat | tr '\n' ' ')\t$(cat $CG/memory.swap.current)\t$(grep -E '^(pswpin|pswpout|workingset_refault_anon) ' $CG/memory.stat | tr '\n' ' ')" >> $OUT; sleep 2; done ) &
SP=$!; F0=$(sed -n 2p $CG/memory.pressure | grep -o 'total=[0-9]*' | cut -d= -f2); T0=$(date +%s)
LC_ALL=C pct exec 9202 -- "$@"; RC=$?
T1=$(date +%s); F1=$(sed -n 2p $CG/memory.pressure | grep -o 'total=[0-9]*' | cut -d= -f2); sleep 4; kill $SP
PK=$(cut -f2 $OUT | grep -o 'avg10=[0-9.]*' | cut -d= -f2 | sort -n | tail -1)
echo "$L: rc=$RC seconds=$((T1-T0)) full-stall-total=$(( (F1-F0)/1000 )) ms peak full avg10=$PK % samples=$(wc -l < $OUT)"