Skip to content

Instantly share code, notes, and snippets.

@struberg
Created December 12, 2012 14:26
Show Gist options
  • Save struberg/4268128 to your computer and use it in GitHub Desktop.
Save struberg/4268128 to your computer and use it in GitHub Desktop.
set the speed of your CPU to a fixed frequency. This makes benchmarkes much more reproducible.
#!/bin/sh
if [ "$1" = "ondemand" ]; then
echo "setting cpu governer ONDEMAND"
for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
do
echo ondemand> "$f"
done
exit
else
for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
do
echo userspace > "$f"
done
fi
for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
do
echo $1
echo $1 > "$f"
done
echo 'all CPU cores set to speed'
for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
do
cat "$f"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment