konkor / cpufreq

System Monitor and Power Manager
https://konkor.github.io/cpufreq/
GNU General Public License v3.0
578 stars 60 forks source link

set a Power Profile from terminal #196

Open harshit9715 opened 2 years ago

harshit9715 commented 2 years ago

I am trying to disable few cores and reduce frequency when I close the lid.

Hi, I am able to run a script when I close my laptop lid.

I was wondering if I can switch power profiles (custom ones) using CLI.

konkor commented 2 years ago

Actually, it's possible. You just have to know GUID of a custom profile. Unfortunately, there is no such info in GUI yet but you could take a look at dconf-editor or dconf and find desired GUIDs for your script:

dconf dump  "/org/gnome/shell/extensions/cpufreq/"

# YOU CAN USE IT like this:

$ cpufreq-application -p efd73d3a96e8e59fc8cbb3625c8a4b5b

# OR

$ cpufreq-application -p efd73d3a96e8e59fc8cbb3625c8a4b5b --no-save

# (to switch without remembering)

$ cpufreq-application --help
Usage:
  cpufreq-application [OPTION...]

Help Options:
  -h, --help                 Show help options
  --help-all                 Show all help options
  --help-gtk                 Show GTK+ Options
  --help-gapplication        Show GApplication options

Application Options:
  --debug                    Enable debugging messages
  --verbose                  Enable verbose output
  --extension                Enable extension mode
  --no-save                  Do not remember applying profile
  -p, --profile=GUID         Enable power profile battery|balanced|performance|system|user|GUID
  --display=DISPLAY          X display to use
konkor commented 2 years ago

Also, you can use cpufreqctl for tuning CPU parameters from user space.

$ cpufreqctl --help
Package version: 21
Usage:
  cpufreqctl [OPTION[=VALUE]...]

  --help          Show help options
  --version       Package version
  --verbose, -v   Verbose output

basic options
  --set=VALUE     Set VALUE for selected option
  --core=NUMBER   Apply selected option just for the core NUMBER (0 ~ N - 1)
  --available     Get available values instead of default: current

  --driver        Current processor driver
  --governor      Scaling governor's options
  --on            Turn on --core=NUMBER
  --off           Turn off --core=NUMBER
  --frequency-min Minimal frequency options
  --frequency-max Maximum frequency options
  --boost         Current cpu boost value

Frequency options
  --frequency     Frequency options
  --max           Get a maximum value of the current frequencies
  --min           Get a minimum value of the current frequencies
  --average       Get an average value of the current frequencies

intel_pstate options
  --no-turbo      Current no_turbo value
  --min-perf      Current min_perf_pct options
  --max-perf      Current max_perf_pct options

Package options
  --install       Install extra components for all users
  --uninstall     Uninstall extra components for all users
  --update-fonts  Update font cache
  --reset         Reset to defaults for current user

Events options
  --throttle      Get thermal throttle counter
  --throttle-event Get kernel thermal throttle events counter
  --irqbalance     Get irqbalance presence