Overclocking

(New page: <nowiki>#</nowiki> ''WORK IN PROGRESS, HELP IF YOU WANT'' =Necessary links= [http://talk.maemo.org/showthread.php?t=39753 talk.maemo.org: Overclock the N900?] [http://www.saunalahti.fi...)
Line 17: Line 17:
==Show current CPU frequency==
==Show current CPU frequency==
-
  echo $((`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq`/1000)) MHz
+
  awk '{print $1/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
Line 28: Line 28:
Replace 600 with desired maximum frequency. The list of available frequencies on your device/kernel can be obtained with command:
Replace 600 with desired maximum frequency. The list of available frequencies on your device/kernel can be obtained with command:
-
  cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
+
  awk '{print $1/1000" MHz,",$2/1000" MHz,",$3/1000" MHz,",$4/1000" MHz,",$5/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
-
The values returned are in kHz (that means you have to divide them by 1000 or remove last three zeroes.
+
If the last value returned is 0 MHz, this means that you have only 4 available frequencies.
Line 38: Line 38:
  #!/bin/sh
  #!/bin/sh
-
  sum=`cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | awk '{SUM += $2} END {print SUM}'`
+
  awk '{print "\nCurrent frequency: "$1/1000" MHz\n"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
 +
sum=`awk '{SUM += $2} END {print SUM}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state`
  sum2=`cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 4 | awk '{SUM += $2} END {print SUM}'`
  sum2=`cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 4 | awk '{SUM += $2} END {print SUM}'`
  cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f",($2 * 100)/"'"$sum"'"); printf ("'" %%, when not idle "'"); printf ("%.1f %\n",($2 * 100)/"'"$sum2"'")}'
  cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f",($2 * 100)/"'"$sum"'"); printf ("'" %%, when not idle "'"); printf ("%.1f %\n",($2 * 100)/"'"$sum2"'")}'
Line 44: Line 45:
  cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 3 | tail -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f",($2 * 100)/"'"$sum"'"); printf ("'" %%, when not idle "'"); printf ("%.1f %\n",($2 * 100)/"'"$sum2"'")}'
  cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 3 | tail -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f",($2 * 100)/"'"$sum"'"); printf ("'" %%, when not idle "'"); printf ("%.1f %\n",($2 * 100)/"'"$sum2"'")}'
  cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 4 | tail -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f",($2 * 100)/"'"$sum"'"); printf ("'" %%, when not idle "'"); printf ("%.1f %\n",($2 * 100)/"'"$sum2"'")}'
  cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 4 | tail -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f",($2 * 100)/"'"$sum"'"); printf ("'" %%, when not idle "'"); printf ("%.1f %\n",($2 * 100)/"'"$sum2"'")}'
-
  cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | tail -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f %\n",($2 * 100)/"'"$sum"'")}'
+
  cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | tail -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f %\n\n",($2 * 100)/"'"$sum"'")}'
Output example:
Output example:
 +
Current frequency: 125 MHz
 +
  800 MHz: overall 5.0 %, when not idle 70.0 %
  800 MHz: overall 5.0 %, when not idle 70.0 %
  550 MHz: overall 0.2 %, when not idle 2.0 %
  550 MHz: overall 0.2 %, when not idle 2.0 %

Revision as of 18:44, 8 April 2010

# WORK IN PROGRESS, HELP IF YOU WANT


Contents

Necessary links

talk.maemo.org: Overclock the N900?

Kernels

talk.maemo.org: Compiling custom kernels for P1.1 (with fiasco-gen)

# ADD IMPORTANT POSTS FROM THE TOPICS


Useful stuff

Show current CPU frequency

awk '{print $1/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq


Set maximum CPU frequency

From root terminal:

echo $((600*1000)) > /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq

Replace 600 with desired maximum frequency. The list of available frequencies on your device/kernel can be obtained with command:

awk '{print $1/1000" MHz,",$2/1000" MHz,",$3/1000" MHz,",$4/1000" MHz,",$5/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies

If the last value returned is 0 MHz, this means that you have only 4 available frequencies.


Analyzing time_in_state

This script generates readable output (percentage) of states used. It is designed for 5 available states. If you have 4 available frequencies (stock kernel) simply remove 7th line and lower "head -n 4" to "head -n 3" in 3rd line.

#!/bin/sh
awk '{print "\nCurrent frequency: "$1/1000" MHz\n"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
sum=`awk '{SUM += $2} END {print SUM}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state`
sum2=`cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 4 | awk '{SUM += $2} END {print SUM}'`
cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f",($2 * 100)/"'"$sum"'"); printf ("'" %%, when not idle "'"); printf ("%.1f %\n",($2 * 100)/"'"$sum2"'")}'
cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 2 | tail -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f",($2 * 100)/"'"$sum"'"); printf ("'" %%, when not idle "'"); printf ("%.1f %\n",($2 * 100)/"'"$sum2"'")}'
cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 3 | tail -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f",($2 * 100)/"'"$sum"'"); printf ("'" %%, when not idle "'"); printf ("%.1f %\n",($2 * 100)/"'"$sum2"'")}'
cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 4 | tail -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f",($2 * 100)/"'"$sum"'"); printf ("'" %%, when not idle "'"); printf ("%.1f %\n",($2 * 100)/"'"$sum2"'")}'
cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | tail -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f %\n\n",($2 * 100)/"'"$sum"'")}'

Output example:

Current frequency: 125 MHz

800 MHz: overall 5.0 %, when not idle 70.0 %
550 MHz: overall 0.2 %, when not idle 2.0 %
500 MHz: overall 2.0 %, when not idle 25.0 %
250 MHz: overall 0.3 %, when not idle 3.0 %
125 MHz: overall 92.5 %