From 6d380a3c3f5cc3cac1fb3bea913b18bbfb1f3a13 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Tue, 29 Sep 2026 21:41:26 -0400 Subject: guest-diag: one-shot gdb/state samplers for timed post-control captures gdb_now.sh attaches once at a host-chosen moment (final RM control) and dumps all threads; oneshot_gdb.sh triggers on user-running state; state_log.sh records state/syscall/wchan so kernel busy-waits can be told apart from real userspace spins. --- tools/guest-diag/state_log.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tools/guest-diag/state_log.sh (limited to 'tools/guest-diag/state_log.sh') diff --git a/tools/guest-diag/state_log.sh b/tools/guest-diag/state_log.sh new file mode 100644 index 0000000..de3d6ed --- /dev/null +++ b/tools/guest-diag/state_log.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# state_log.sh - 200ms sampler of state/syscall/wchan for the whole run. +PID="$1" +: > /tmp/state.log +while kill -0 "$PID" 2>/dev/null; do + st=$(awk '{print $3}' /proc/$PID/stat 2>/dev/null) + sc=$(cat /proc/$PID/syscall 2>/dev/null | cut -d' ' -f1-3) + wc=$(cat /proc/$PID/wchan 2>/dev/null) + echo "$(date +%T.%3N) st=$st sc=[$sc] wchan=$wc" >> /tmp/state.log + sleep 0.2 +done +echo "$(date +%T.%3N) GONE" >> /tmp/state.log -- cgit v1.2.3