Skip to content

Instantly share code, notes, and snippets.

@musaprg
Last active November 27, 2021 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save musaprg/5b5f14f6ab13be0c4b64d281699fd3cd to your computer and use it in GitHub Desktop.
Save musaprg/5b5f14f6ab13be0c4b64d281699fd3cd to your computer and use it in GitHub Desktop.
本当はsudo使った方がいいけど諸事情によりsuしか使えない時にCPU-scalingを切ってベンチマークを回す君
#!/bin/bash
set -eu
if [ $# -lt 1 ]; then
echo "Usage: benchexec <your command>"
exit 1
fi
echo "Input your root password to change the CPU governor for disabling CPU-scaling."
read -s -p "Password: " pass
yes "$pass" | su - root -c "cpupower frequency-set --governor performance"
$@
yes "$pass" | su - root -c "cpupower frequency-set --governor powersave"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment