Files
arch-dotfiles/scripts/power-monitor
2026-06-18 10:10:37 +02:00

10 lines
306 B
Bash
Executable File

#!/bin/bash
RAPL0="/sys/class/powercap/intel-rapl:0/energy_uj"
RAPL1="/sys/class/powercap/intel-rapl:1/energy_uj"
while true; do
e1=$(( $(cat "$RAPL0") + $(cat "$RAPL1") ))
sleep 2
e2=$(( $(cat "$RAPL0") + $(cat "$RAPL1") ))
echo "scale=1; ($e2 - $e1) / 2000000" | bc > /tmp/power_now
done