Overclocking
# WORK IN PROGRESS, HELP IF YOU WANT
Contents |
Necessary links
talk.maemo.org: Overclock the N900?
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 %