#!/bin/dash # Edit this file for your paths and your processor # # With the intel pstate driver and a i7-2600K processor and turbo on # the min percent is 42 # For a Haswell processor the min percent will be 20 echo "Intel new Pstate Energy loop. Doug Smythies 2014.06.27" if [ -n "$1" ];then sed -i "s/define CALIBRATION.*$/define CALIBRATION $1/" ./consume1.c fi echo "CALIBRATION:" echo " $(cat ./consume1.c|grep 'define CALIBRATION')" cc ./consume1.c -o ./consume1 MAX=$(cat /sys/devices/system/cpu/intel_pstate/max_perf_pct) MIN=$(cat /sys/devices/system/cpu/intel_pstate/min_perf_pct) COUNTER=$MIN while [ $COUNTER -lt 101 ]; do echo "$COUNTER" > /sys/devices/system/cpu/intel_pstate/max_perf_pct # force min also echo "$COUNTER" > /sys/devices/system/cpu/intel_pstate/min_perf_pct # Don't force min also, but set it anyhow, in case I forgot. # echo 42 > /sys/devices/system/cpu/intel_pstate/min_perf_pct # Sleep probably not needed. sleep 1 # If higher work / sleep frequencies are used then calibration (done at 5 hertz) # will be off and there will be overruns at min pstate. # It is not that important ./turbostat -S -J ./consume1 100 5 10 # ./turbostat -S -J ../c/consume1 100 200 10 COUNTER=$((COUNTER+2)) done echo $MIN > /sys/devices/system/cpu/intel_pstate/min_perf_pct echo $MAX > /sys/devices/system/cpu/intel_pstate/max_perf_pct