Adding scripts, commands, and logging scaffolding

This commit is contained in:
Carlos Gutierrez
2025-10-05 01:59:00 +00:00
parent f1debadbb3
commit 1d39c0cbd7
15 changed files with 193 additions and 89 deletions

38
scripts/60_bundle_logs.sh Normal file → Executable file
View File

@@ -1,23 +1,29 @@
#!/bin/bash
set -eu
source "$(dirname "$0")/00_env.sh"
. "$(dirname "$0")/env.sh"
# terminal excerpts
: > "$LOGROOT/TERMINAL_EXCERPTS.txt"
for f in "$LOGROOT"/*.stdout.log; do
echo "===== $(basename "$f") =====" >> "$LOGROOT/TERMINAL_EXCERPTS.txt"
(head -n 20 "$f"; echo "..."; tail -n 20 "$f") >> "$LOGROOT/TERMINAL_EXCERPTS.txt"
echo >> "$LOGROOT/TERMINAL_EXCERPTS.txt"
TE="$LOG_DATA/TERMINAL_EXCERPTS.txt"
SE="$LOG_DATA/STATS_EXCERPTS.txt"
: > "$TE"; : > "$SE"
for f in "$LOG_DATA"/*.stdout.log; do
[ -f "$f" ] || continue
echo "===== $(basename "$f") =====" >> "$TE"
(head -n 20 "$f"; echo "..."; tail -n 20 "$f") >> "$TE"
echo >> "$TE"
done
echo "[bundle] wrote $LOGROOT/TERMINAL_EXCERPTS.txt"
# stats excerpts
: > "$LOGROOT/STATS_EXCERPTS.txt"
for d in "$OUTROOT"/*; do
[[ -d "$d" ]] || continue
echo "===== $(basename "$d") =====" >> "$LOGROOT/STATS_EXCERPTS.txt"
awk '/^sim_seconds|^system\.cpu\.ipc|^system\.cpu0\.ipc|^system\.cpu\.numCycles|^system\.cpu0\.numCycles|^system\.cpu\.commit\.committedInsts|^system\.cpu0\.commit\.committedInsts|^system\.l2\.overall_miss_rate::total/' "$d/stats.txt" >> "$LOGROOT/STATS_EXCERPTS.txt"
echo >> "$LOGROOT/STATS_EXCERPTS.txt"
for d in "$OUT_DATA"/*; do
[ -d "$d" ] || continue
S="$d/stats.txt"
[ -f "$S" ] || continue
echo "===== $(basename "$d") =====" >> "$SE"
awk '/^sim_seconds|^system\.cpu\.ipc|^system\.cpu0\.ipc|^system\.cpu\.numCycles|^system\.cpu0\.numCycles|^system\.cpu\.commit\.committedInsts|^system\.cpu0\.commit\.committedInsts|^system\.l2\.overall_miss_rate::total/' "$S" >> "$SE"
echo >> "$SE"
done
echo "[bundle] wrote $LOGROOT/STATS_EXCERPTS.txt"
# mirror to repo
cp "$TE" "$LOG_IOT/TERMINAL_EXCERPTS.txt"
cp "$SE" "$LOG_IOT/STATS_EXCERPTS.txt"
echo "[bundle] wrote $TE and $SE (mirrored into iot/logs)"