Getting full performance out of your Intel CPU in Ubuntu.

So i was showing my friend my stats on my Intel Core i5, and i was using “cat /proc/cpuinfo“. He looked at it and was like “Oh i need to send you a script”. He said that Ubuntu doesn’t take full advantage of Intel Processors. Mainly the i3, i5, and i7. So he gave me this script, and i ran it. So i noticed a boost in the “cpu Mhz” section..by alot.

Here is the link to my friends script.

http://www.mediafire.com/download/2x1lpl66gke0sdp/scale.sh

Here is the difference from before i ran the script and after.

BEFORE:

cat /proc/cpuinfo
processor    : 0
vendor_id    : GenuineIntel
cpu family    : 6
model        : 58
model name    : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping    : 9
microcode    : 0x12
cpu MHz        : 1200.000         <—–(“This right here is default on my processor”)
cache size    : 3072 KB
physical id    : 0
siblings    : 4
core id        : 0
cpu cores    : 2
apicid        : 0
initial apicid    : 0
fdiv_bug    : no
hlt_bug        : no
f00f_bug    : no
coma_bug    : no
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4988.57
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 1
vendor_id    : GenuineIntel
cpu family    : 6
model        : 58
model name    : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping    : 9
microcode    : 0x12
cpu MHz        : 1200.000
cache size    : 3072 KB
physical id    : 0
siblings    : 4
core id        : 0
cpu cores    : 2
apicid        : 1
initial apicid    : 1
fdiv_bug    : no
hlt_bug        : no
f00f_bug    : no
coma_bug    : no
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4988.57
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 2
vendor_id    : GenuineIntel
cpu family    : 6
model        : 58
model name    : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping    : 9
microcode    : 0x12
cpu MHz        : 1200.000
cache size    : 3072 KB
physical id    : 0
siblings    : 4
core id        : 1
cpu cores    : 2
apicid        : 2
initial apicid    : 2
fdiv_bug    : no
hlt_bug        : no
f00f_bug    : no
coma_bug    : no
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4988.57
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 3
vendor_id    : GenuineIntel
cpu family    : 6
model        : 58
model name    : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping    : 9
microcode    : 0x12
cpu MHz        : 1200.000
cache size    : 3072 KB
physical id    : 0
siblings    : 4
core id        : 1
cpu cores    : 2
apicid        : 3
initial apicid    : 3
fdiv_bug    : no
hlt_bug        : no
f00f_bug    : no
coma_bug    : no
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4988.57
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

As you can see, my “cpu MHz” is at 1200.000. This will go up after the script.

AFTER:

cat /proc/cpuinfo
processor    : 0
vendor_id    : GenuineIntel
cpu family    : 6
model        : 58
model name    : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping    : 9
microcode    : 0x12
cpu MHz        : 2501.000               <—(“As you can tell this went up after the script”)
cache size    : 3072 KB
physical id    : 0
siblings    : 4
core id        : 0
cpu cores    : 2
apicid        : 0
initial apicid    : 0
fdiv_bug    : no
hlt_bug        : no
f00f_bug    : no
coma_bug    : no
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4988.57
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 1
vendor_id    : GenuineIntel
cpu family    : 6
model        : 58
model name    : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping    : 9
microcode    : 0x12
cpu MHz        : 2501.000
cache size    : 3072 KB
physical id    : 0
siblings    : 4
core id        : 0
cpu cores    : 2
apicid        : 1
initial apicid    : 1
fdiv_bug    : no
hlt_bug        : no
f00f_bug    : no
coma_bug    : no
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4988.57
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 2
vendor_id    : GenuineIntel
cpu family    : 6
model        : 58
model name    : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping    : 9
microcode    : 0x12
cpu MHz        : 2501.000
cache size    : 3072 KB
physical id    : 0
siblings    : 4
core id        : 1
cpu cores    : 2
apicid        : 2
initial apicid    : 2
fdiv_bug    : no
hlt_bug        : no
f00f_bug    : no
coma_bug    : no
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4988.57
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 3
vendor_id    : GenuineIntel
cpu family    : 6
model        : 58
model name    : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping    : 9
microcode    : 0x12
cpu MHz        : 2501.000
cache size    : 3072 KB
physical id    : 0
siblings    : 4
core id        : 1
cpu cores    : 2
apicid        : 3
initial apicid    : 3
fdiv_bug    : no
hlt_bug        : no
f00f_bug    : no
coma_bug    : no
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4988.57
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

So now i am getting full performance/speed out of my CPU:

So now i need to explain how to get the script to work. I took the script and placed it in my “/usr/bin” folder, and did “sudo chmod +x scale.sh“. I then noticed that it does give you a few options when you run it.  “USAGE: /usr/bin/scale.sh [conservative|ondemand|userspace|powersave|performance]”. So run it like it so “sudo scale.sh performance“.

This could possible help boost the performance of intel graphics as well. I dont ever use the intel graphics card for games, but i should check it out.

I will soon explain about getting it to startup on startup. I haven’t messed with it yet. If you beat me to it, go ahead and share it.

I hope you enjoyed this post, and im sorry if has been a while since i have shared something with you. I have been busy. If you have any questions or comments please feel free to speak out to me! I will be here to help out.

-Orkultus-

Advertisements

23 comments on “Getting full performance out of your Intel CPU in Ubuntu.

  1. MIcah Wyatt says:

    After some monkeying around, I was able to get it to work on login by adding it to a start up and using the command /usr/bin/scale.sh performance

  2. orkultus says:

    Ah yes. I was looking for that startup applications program to do the same. I am using LXDE on peppermint OS Four, so i think i need to find it’s alternative.

  3. orkultus says:

    So i guess i can add it to /home/chuck/.config/autostart/. The only problem is that when you run the script it requires root. Just wondering how to get the program to start from a command line that requires root, and it provides the root password in the same line.

    -Orkultus-

  4. orkultus says:

    Ah so apparently i can do this like so.

    echo (password) | sudo -S /usr/bin/scale.sh performance

    Sweet. Going to give that a try.

    -Orkultus-

  5. Kyle Miller says:

    Does this just force the governor into performance mode? If left as is without the script, doesn’t CPU scale up to those speeds as needed?

    • orkultus says:

      It does force it into performance mode. I noticed on mine, that it doesn’t go up to performance when on ondemand mode.

      • Kyle Miller says:

        I think you are right. I was reading some other pages on this. Apparently the governor is not too good about throttling the CPU up on demand. That is disappointing. This should work well for the most popular line of processors.

        So, your post is very helpful. I’ve implemented on my Ubuntu install. Thanks!

      • orkultus says:

        You are very welcome.

  6. VTCmaniac says:

    Could someone make a step by step post going from downloading the script with the download url directly to the specific folder that it needs to go to and then how to get it working? I am a complete newb but I am using ubuntu 12.10 on a VPS to take advantage of the VPS’s CPUs for mining a cryptocurrency called vertcoin.. theres a lot of money to be made! vertcoin.org

  7. Mark says:

    I have done as explained – finally managed to copy the file to /usr/bin etc. however upon executing the file using “/usr/bin/scale.sh performance” it spits out:

    /usr/bin/scale.sh: line 1: syntax error near unexpected token `<'
    /usr/bin/scale.sh: line 1: ` scale ‘

    Am i missing something here ?

    • orkultus says:

      I am not sure why you are experiencing this. I had just recently used this script on a fresh install of Linux Mint 17 on my Intel powered laptop, and it worked well.

  8. Fábio Filho says:

    Its great your script, but doens’t works in my pc.
    i got this message:

    ===
    sudo sh scale.sh performace
    scale.sh: 13: scale.sh: Syntax error: “(” unexpected
    ===

    sudo scale.sh performace
    sudo: scale.sh: command not found

    Can you help me?

  9. orkultus says:

    OK so i just ran the script on my Linux Mint 17 install, and it works fine.

    Here is what my script says line by line

    #!/bin/bash

    available_governors=$(cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors \
    | head -1 | sed -e ‘s/ \([a-zA-Z0-9]\)/|\1/g’ -e ‘s/ $//’)
    if [ $# -ne 1 ]
    then

    echo “USAGE: $0 [$available_governors]”
    fi

    ## CPU Governor path
    #/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    function current_cpu_governor ()
    {
    echo -n “Current CPU Scaling Governor is: ”
    cpu_scaling_governor=”NOT SET”
    for governor in $(ls /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor)
    do
    cpu_scaling_governor=$(cat $governor)
    done
    echo “$cpu_scaling_governor”
    }

    current_cpu_governor;

    ## Exit, if no governor is provided
    new_governor=””
    if [ $# -eq 0 ]
    then
    exit 0
    else
    new_governor=”$1″
    fi

    ## Run as root always
    user_id=`whoami`
    if [[ “$user_id” != “root” ]]
    then
    echo “$0: please run this script as root user.”
    exit
    fi

    if [ -z $(echo $available_governors | sed -e ‘s/^/|/’ -e ‘s/$/|/’ | grep “|$new_governor|”) ]
    then
    echo “Sorry, this mode ‘$new_governor’ is not supported.”
    exit 1
    else
    echo “Setting CPU into ‘$new_governor’ Mode…”
    fi
    ## Now set cpu governor to the given mode
    for governor in $(ls /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor)
    do
    echo “$new_governor” > $governor
    done
    current_cpu_governor;

    exit 0

  10. orkultus says:

    So i just got the same error by executing it this way “sudo ./scale.sh”…but with the bash script i made to make it run called “cpuboost”…it works. So all i can figure is try to run it like so without putting sh or ./ after sudo…try “sudo /usr/bin/scale.sh performance” or wherever you put the scale.sh script…. it works for me with that command. Or make the quick bash script that i explained called cpuboost or whatever you want to call it, and put it in your /usr/bin and chmod it.

  11. orkultus says:

    Even executing it with “sudo bash scale.sh performance” works.

  12. marianowadel says:

    IMHO changing the scheduler might introduce heating and high power consumption issues, specially on mobile platforms (like the OP’s). I wouldn’t try this without doing some background research before.

  13. Ed says:

    marianowadel is correct. Ubuntu usually works with the “on-demand” option, which speeds up the CPU only when necessary and slows it down when it is not too busy. If you set it to “performance” all the time you are going to waste power, heating up your computer and making its life shorter.

    I use indicator-cpufreq, an app that displays an icon on the top bar of Unity showing how much of its maximum speed the cpu is using at the moment. It allows you to set the governor (“powersave”, “performance”, “ondemand”, “conservative”) or the cpu frequency itself from a drop-down list.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s