mirror of
https://github.com/ebrandi/FDD-book.git
synced 2026-12-06 00:23:30 +00:00
Organize companion code and materials by book part: part-01/ Foundations part-02/ Kernel & driver fundamentals part-03/ Character & block devices part-04/ Networking & storage part-05/ Buses & advanced topics part-06/ Debugging & performance part-07/ Real-world drivers appendices/ Supplementary material README.md Overview and build instructions
23 lines
550 B
Bash
Executable file
23 lines
550 B
Bash
Executable file
#!/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
|