#!/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