1

I have a very strange problem - when I play any basic browser flash game, CPU goes literally mad, it becomes very busy and overheated.

CPU load while playing flash game

I tried different browsers - did not help
I tried playing videos with flash players - everything normal, no overheat, so it's just games problem.

Here's one more screenshot to prove that from a lot of chrome cards, only one with flash game loads CPU.

enter image description here

I also found article about application called indicator, which allows you to set CPU modes and frequency, but I can't find it after installation.

Thanks for any advice that could help me.

  • Why not go get yourself a 212 Evo? – Android Dev Jun 2 '16 at 12:11
  • I googled it and by its dimensions I suppose it's for desktops. However, I have laptop. – PKM Jun 2 '16 at 12:25
  • Yeah, its for desktops. I made the false assumption you were on a desktop, since I see you have an 8-core CPU & 12GB of RAM. – Android Dev Jun 2 '16 at 12:28
4

You can throttle down your max CPU speed to keep things a little cooler.

Download cpufreq in terminal with sudo apt-get install cpufrequtils

If you don't have a /bin folder in your home folder, create one in terminal with mkdir ~/bin.

Once installed, create a new script in your home/bin folder in terminal

gedit ~/bin/cpuss

Paste this in the file:

#!/bin/bash
COUNTER=0
CPU=$(grep -c ^processor /proc/cpuinfo)
if [ "$1" > 800 ] || [ "$1" <= 3100 ]; then
    while [  $COUNTER -lt $CPU ]; do
            sudo cpufreq-set -c $COUNTER -u $1Mh
        let COUNTER=COUNTER+1 
    done
    cpufreq-info | grep policy
else
    echo 'Not a valid CPU speed.  Must be between 800 and 3100 Mhz'
fi

Save and close the file.

This next part is important!! In terminal, type in cpufreq-info | grep policy.

This will show you an output like this:

current policy: frequency should be within 800 MHz and 3100 MHz.
current policy: frequency should be within 800 MHz and 3100 MHz.
current policy: frequency should be within 800 MHz and 3100 MHz.
current policy: frequency should be within 800 MHz and 3100 MHz.
current policy: frequency should be within 800 MHz and 3100 MHz.
current policy: frequency should be within 800 MHz and 3100 MHz.
current policy: frequency should be within 800 MHz and 3100 MHz.
current policy: frequency should be within 800 MHz and 3100 MHz.

You'll see one line for each core so you might see that message several times.

Now take note of the 2 numbers in that output, in my example 800 and 3100. Those are the minimum and maximum speeds in MegaHertz.

Now again in terminal type gedit ~/bin/cpuss

You can see the 2 values in the 4th and 11th lines. Change those number to the ones that were shown to you before, in my example it was 800 and 3100.

Save and close the script.

FINALLY, in terminal, type chmod +x ~/bin/cpuss to make the script executable.

Now at anytime, you can type in how many Mhz you max speed should be. For example, in terminal, type

~/bin/cpuss 1000 and this will limit your max speed to 1000Mhz, or, 1Ghz, which is more than enough to run most flash games, and will keep your computer cooler.

For some reason, something in Ubuntu resets the cpu max speed now and then. So if you notice it get hotter all of a sudden, run the command again.

You can also go even lower, like 850 or 900, as long as it's higher than the original number you saw. But the way I wrote the script, and the reason you had to find those 2 numbers, you don't have to worry about the number being too low or too high because it checks the limits first.

Also wanted to note that for some reason, Google Chrome games from the Web Store sometimes bypass the max limit somehow. But normal flash games are fine.

If you add /bin to your $PATH, you can execute cpuss from anywhere in terminal without the ~/bin/ part.

Do this by editing your /.profile file. In terminal, gedit ~/.profile.

At the bottom of this file, if you don't have the following part, add it:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Save and close. This will let files in your ~/bin directory be accessible from anywhere. If you had to add that bit of code, log out and log back in for changes to take effect. Now you can use the cpuss script in terminal no matter what directory you're currently in.

BONUS SCRIPT

Below is a separate but handy script to verify the first one is working.

Put this in a file, save and make it executable.

#!/bin/bash
while sleep 1;do clear && cpufreq-info | grep 'CPU frequency' && printf '\n Press CTRL+C to exit';done

When you run it, it'll show you this output

  current CPU frequency is 800 MHz.
  current CPU frequency is 800 MHz.
  current CPU frequency is 809 MHz.
  current CPU frequency is 804 MHz.
  current CPU frequency is 891 MHz.
  current CPU frequency is 800 MHz.
  current CPU frequency is 830 MHz.
  current CPU frequency is 894 MHz.

 Press CTRL+C to exit

It'll update every second, and you can keep track of the speeds of all your cores.

  • This is cool... – Ajay Kulkarni Jun 3 '16 at 5:10
  • @AjayKulkarni Thank you! My laptop runs hot often so I decided to come up with a solution, and this helped me a lot. – Dorian Jun 3 '16 at 5:16
  • Even my laptop had heating problems when I was using ubuntu 14.04 LTS, upgraded to 15.10 and heating problems are gone. Bit reluctant to upgrade to 16.04 because I see lot of bugs related to 16.04 in this forum – Ajay Kulkarni Jun 3 '16 at 5:24
  • Thank you very much, it worked! And can you please tell me how to add /bin to $PATH? I'm still noob in these things – PKM Jun 3 '16 at 11:24
  • @PKM No problem, I added what to do for the /bin folder in my answer. Make sure that the folder in your home folder is bin all lowercase. Linux is case-sensitive so Bin wouldn't work. – Dorian Jun 3 '16 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.