#!/bin/sh
# $UFP$
#set -x

# For servers, workstations, etc.
#value=0

# Balanced between full CPU utilisation and full power savings.
#value=50

# For desktops, laptops, etc.
value=100

# Accept override from the command line.
if [ -n "${1}" ]; then
  value=${1}
fi

readonly value

ncpu=`sysctl -n hw.ncpu`
readonly ncpu

i=0
while [ "${i}" -lt "${ncpu}" ]; do
  sysctl dev.hwpstate_intel.${i}.epp=${value}
  i=$(( i + 1 ))
done

# EOF
