mirror of
https://github.com/ebrandi/FDD-book.git
synced 2026-12-06 08:33:30 +00:00
24 lines
550 B
Bash
24 lines
550 B
Bash
|
|
#!/bin/sh
|
||
|
|
#
|
||
|
|
# count-events.sh - count instructions retired and LLC misses during
|
||
|
|
# a fixed-duration workload window.
|
||
|
|
#
|
||
|
|
# Usage: ./count-events.sh [duration_seconds]
|
||
|
|
|
||
|
|
DURATION=${1:-10}
|
||
|
|
|
||
|
|
if ! kldstat | grep -q hwpmc; then
|
||
|
|
echo "Loading hwpmc..."
|
||
|
|
sudo kldload hwpmc
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo "Counting cycles and instructions for $DURATION seconds..."
|
||
|
|
echo "Run a workload in another terminal now."
|
||
|
|
echo
|
||
|
|
|
||
|
|
sudo pmcstat -c 0 -w $DURATION -s instructions -s cycles
|
||
|
|
|
||
|
|
echo
|
||
|
|
echo "LLC_MISSES count for $DURATION seconds..."
|
||
|
|
sudo pmcstat -c 0 -w $DURATION -s LLC_MISSES
|