Skip to content

Instantly share code, notes, and snippets.

@naota
Created June 18, 2014 06:54
Show Gist options
  • Save naota/cffc63c0ecf9a94a6fd9 to your computer and use it in GitHub Desktop.
Save naota/cffc63c0ecf9a94a6fd9 to your computer and use it in GitHub Desktop.
#!/bin/bash
case $1 in
config)
cat <<'EOM'
graph_category system
graph_title energy
graph_vlabel Energy Watt
graph_args --base 1000 -l 0
package.label Package
package.type COUNTER
package.max 65535
package.min 0
core.label Core
core.type COUNTER
core.max 65535
core.min 0
uncore.label Graphics UnCore
uncore.type COUNTER
uncore.max 65535
uncore.min 0
EOM
exit 0
;;
esac
cd /sys/class/powercap
printf "package.value "
cat "intel-rapl:0"/energy_uj | perl -ne 'print int($_/1000000),"\n"'
printf "core.value "
cat "intel-rapl:0:0"/energy_uj | perl -ne 'print int($_/1000000),"\n"'
printf "uncore.value "
cat "intel-rapl:0:1"/energy_uj | perl -ne 'print int($_/1000000),"\n"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment