CPU frequency went down

MR ZenWiz mrzenwiz at gmail.com
Tue Dec 7 02:21:00 UTC 2010


On Mon, Dec 6, 2010 at 10:32 AM, A. Kromic <akromic at gmail.com> wrote:
>
> Thank you for your reply.
> No it doesn't scale up, it did it normally before (I've actually set it
> to ran at full speed on AC). Because most of the time i do hog the CPU,
> since it stopped working at full speed I have a really hard time :(
>
Here's a shell script I wrote many moons ago that should display what
your current and maximum CPU speeds are:

#!/bin/bash

# A bash script to show the current and maxmimum speeds of a self-throttling CPU
# by Mark A. Richter GPL 2010/12/06

# echo "$0 $*"

if [[ "$1" == "-x" ]]; then
	shift
	setx="-x"
	set -x
fi

if [[ -z "$1" ]]; then
	exec $0 $setx -errnull 2> /dev/null
	exit
fi

set_mhz() {
mhz=`awk '$1 == "cpu" && $2 == "MHz" { print $NF; }' /proc/cpuinfo |
tr "\n" " "`
cpus=`grep processor /proc/cpuinfo | wc -l`
}

set_mhz
echo "Current speed: ${mhz}MHz"
# echo -n "Type <enter> for maximum speed: "
# read ln
while [[ $cpus != 0 ]]; do
	cat /dev/zero > /dev/null 2> /dev/null &
	cpus=$(( $cpus - 1))
done
sleep 1;
set_mhz
echo "Maximum speed: ${mhz}MHz"
for i in `ps -ef | grep zero | grep -v grep | awk '{print $2}'`; do
	kill $i
done
wait




More information about the ubuntu-users mailing list