summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtools/guest-diag/inject_counters.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/guest-diag/inject_counters.sh b/tools/guest-diag/inject_counters.sh
index a2a8371..b4e20bd 100755
--- a/tools/guest-diag/inject_counters.sh
+++ b/tools/guest-diag/inject_counters.sh
@@ -48,6 +48,14 @@ if [ -z "$GRS" ]; then
exit 1
fi
+# Counter index order: observed DESCENDING by channel handle (the client's
+# last-created channel owns counter 0; verified live: trackers waiting on
+# counter idx2/idx3 belong to the channels 2nd/3rd from the top). ORDER=asc
+# restores creation order.
+if [ "${ORDER:-desc}" = "desc" ]; then
+ GRS=$(echo "$GRS" | tr ',' '\n' | sort -r | paste -sd,)
+fi
+
PAIRS=$(timeout 30 "$VMEXEC" exec \
"python3 /tmp/sem_counters.py $PID $PAGE_VA --count=$COUNT --pairs $GRS" \
2>/dev/null | grep -E '^0x[0-9a-f]+,0x[0-9a-f]+,[0-9]+$')