5

Everytime I plug-in or plug-out powersupply the CPU frequency is changed to 'powersave' which results in reduced efficiency. I need to be on 'performance' all the time. I've made a small java utility which I use to turn my CPUs on performance. But this is kind of a too-much-repetitive process as I've to run the Java utility every two hours, whenever I plug-in or plug-out powersupply. Any idea where I can place the commands like this:-

cpufreq-selector -c 0 -g performance  
cpufreq-selector -c 1 -g performance

so that everytime I plug-in or plug-out powersupply then the CPUs are set to performance automatically.

I've Jupiter installed so I believe that might be the culprit. Uninstalling Jupiter is one thing that I haven't tried, however, I'm really interested in knowing what's the standard way of doing this.

Omar Tariq
  • 207
  • 2
  • 6

1 Answers1

4

When you plug in/out the AC adapter, the scripts in /etc/pm/power.d get called with an argument: "true" (if you run on battery), or "false" (if you run with the power adapter).

As far as I know the only package that ships with a "power.d" script that does what you say is powernap-common, specifically its file: /etc/pm/power.d/cpu_frequency. Therefore the first thing to do would be to remove that file.

Anyhow, the default scaling governor in Ubuntu is ondemand, not performance. The ondemand governor is set by /etc/init.d/ondemand during boot. So you may either modify (or replace) /etc/init.d/ondemand or add a new script to /etc/pm/power.d in order to set the performance governor.

New script to /etc/pm/power.d

So I suggest you to create a new file /etc/pm/power.d/frequency-scaling with the following contents:

#!/bin/sh
set -e
for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
do
    echo performance > "$f"
done

The give it executable permissions:

# chmod +x /etc/pm/power.d/frequency-scaling

Modify /etc/init.d/ondemand

Just open /etc/init.d/ondemand and replace all occurrences of ondemand and interactive with performance.

Notes about performance

You probably already know, but I must add that the performance scaling governor will make your CPU run always at the highest frequency. This means that often your computer will consume more power than required and will heat more than it should.

Instead, interactive/_ondemand_ gives you both speed and power saving.

  • 1
    Thanks for the detailed answer and the precaution. I really appreciate your knowledge about Ubuntu distro. – Omar Tariq Sep 17 '13 at 13:00