Friday, 27 May 2016

How to set and get cpu frequency in Linux

 
 CPU frequency
cat "/sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq"
cat "/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_min_freq"
cat "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"
 
Set Governor:

adb shell echo "userspace" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Set Frequency in KHz:

adb shell su -c "echo "702000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
//min frequency
adb shell su -c "echo "384000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq" 
//MAX frequency
adb shell su -c "echo "384000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq"

Get current CPU Frequency:

adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq

Show available governors:

adb shell su -c "cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors"

No comments:

Post a Comment