Coder Social home page Coder Social logo

shadowblip / powerstation Goto Github PK

View Code? Open in Web Editor NEW
23.0 2.0 3.0 1.22 MB

Open source TDP control and performance daemon with DBus interface

License: GNU General Public License v3.0

Makefile 7.76% Rust 92.11% Dockerfile 0.13%
performance rust tdp linux

powerstation's Introduction

PowerStation Logo
PowerStation


About

PowerStation is an open source TDP control and performance daemon for Linux that can be used to control CPU and GPU settings for better performance and battery life. Performance control is done through DBus to provide a UI-agnostic interface to CPU and GPU settings.

Install

You can install with:

make build
sudo make install

If you are using ArchLinux, you can install PowerStation from the AUR:

yay -S powerstation-bin

Then start the service with:

sudo systemctl enable powerstation
sudo systemctl start powerstation

Documentation

XML specifications for all interfaces can be found in bindings/dbus-xml.

Individual interface documentation can be found here:

Usage

When PowerStation is running as a service, you can interact with it over DBus. There are various DBus libraries available for popular programming languages like Python, Rust, C++, etc.

You can also interface with DBus using the busctl command:

busctl tree org.shadowblip.PowerStation
└─ /org
  └─ /org/shadowblip
    └─ /org/shadowblip/Performance
      ├─ /org/shadowblip/Performance/CPU
      │ ├─ /org/shadowblip/Performance/CPU/Core0
      │ ├─ /org/shadowblip/Performance/CPU/Core1
      │ ├─ /org/shadowblip/Performance/CPU/Core10
      │ ├─ /org/shadowblip/Performance/CPU/Core11
      │ ├─ /org/shadowblip/Performance/CPU/Core2
      │ ├─ /org/shadowblip/Performance/CPU/Core3
      │ ├─ /org/shadowblip/Performance/CPU/Core4
      │ ├─ /org/shadowblip/Performance/CPU/Core5
      │ ├─ /org/shadowblip/Performance/CPU/Core6
      │ ├─ /org/shadowblip/Performance/CPU/Core7
      │ ├─ /org/shadowblip/Performance/CPU/Core8
      │ └─ /org/shadowblip/Performance/CPU/Core9
      └─ /org/shadowblip/Performance/GPU
        ├─ /org/shadowblip/Performance/GPU/Card1
        │ └─ /org/shadowblip/Performance/GPU/Card1/HDMI
        │   └─ /org/shadowblip/Performance/GPU/Card1/HDMI/A
        │     └─ /org/shadowblip/Performance/GPU/Card1/HDMI/A/1
        └─ /org/shadowblip/Performance/GPU/Card2
          └─ /org/shadowblip/Performance/GPU/Card2/eDP
            └─ /org/shadowblip/Performance/GPU/Card2/eDP/1
busctl introspect org.shadowblip.PowerStation /org/shadowblip/Performance/GPU/Card2
NAME                                TYPE      SIGNATURE RESULT/VALUE           FLAGS
org.freedesktop.DBus.Introspectable interface -         -                      -
.Introspect                         method    -         s                      -
org.freedesktop.DBus.Peer           interface -         -                      -
.GetMachineId                       method    -         s                      -
.Ping                               method    -         -                      -
org.freedesktop.DBus.Properties     interface -         -                      -
.Get                                method    ss        v                      -
.GetAll                             method    s         a{sv}                  -
.Set                                method    ssv       -                      -
.PropertiesChanged                  signal    sa{sv}as  -                      -
org.shadowblip.GPU.Card             interface -         -                      -
.EnumerateConnectors                method    -         ao                     -
.Class                              property  s         "integrated"           emits-change
.ClassId                            property  s         "030000"               emits-change
.ClockLimitMhzMax                   property  d         -                      emits-change
.ClockLimitMhzMin                   property  d         -                      emits-change
.ClockValueMhzMax                   property  d         -                      emits-change writable
.ClockValueMhzMin                   property  d         -                      emits-change writable
.Device                             property  s         "Renoir"               emits-change
.DeviceId                           property  s         "1636"                 emits-change
.ManualClock                        property  b         false                  emits-change writable
.Name                               property  s         "card2"                emits-change
.Path                               property  s         "/sys/class/drm/card2" emits-change
.RevisionId                         property  s         "c7"                   emits-change
.Subdevice                          property  s         ""                     emits-change
.SubdeviceId                        property  s         "12b5"                 emits-change
.SubvendorId                        property  s         "1462"                 emits-change
.Vendor                             property  s         "AMD"                  emits-change
.VendorId                           property  s         "1002"                 emits-change
org.shadowblip.GPU.Card.TDP         interface -         -                      -
.Boost                              property  d         11                     emits-change writable
.PowerProfile                       property  s         "max-performance"      emits-change writable
.TDP                                property  d         55                     emits-change writable
.ThermalThrottleLimitC              property  d         95                     emits-change writable

Testing

When PowerStation is running, you can test setting properties with:

busctl set-property org.shadowblip.PowerStation /org/shadowblip/Performance/CPU/Core11 org.shadowblip.CPU.Core Online "b" False

License

PowerStation is licensed under THE GNU GPLv3+. See LICENSE for details.

powerstation's People

Contributors

neroreflex avatar pastaq avatar semantic-release-bot avatar shadowapex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

powerstation's Issues

RyzenAdj exposes more features than we do

We only expose a small selection of capabilities that RyzenAdj provides. Recently some of the more esoteric features have been found to be beneficial on newer devices, such as APU Skin temp on the Legion Go. We should expose everything RyzenAdj can do.

Intel iGPU Frequency Setting doesn't work

Issue existed with the current implementation prior to being ported to PowerStation. Changing the GPU min/max frequency has no effect. This method previously worked so a kernel change may be the cause. We need to identify the issue with the existing method or find a new method.

Enabling/Disabling Cores/Threads should use the best cores in the CPU

To maximize performance, Enabling/Disabling cores should try and prioritize the maximum performing cores/threads.

CPU's like Ryzens have metrics to rate the core.
eg /sys/devices/system/cpu/cpu${N}/acpi_cppc/highest_perf will tell you the relative best performance or each Core.

Also, it should take into account that threads in a cpu, in general, reduce single core perf but give you better aggregate perf (~+22%). Taken to its logical conclusion this could mean each core is only getting 61% of its maximum performance assuming work is evenly distributed across the threads.

So, In an 8 core / 16 thread CPU, the seemingly logically best algorithms would be something like:

If threading is disabled:
Disable the lowest performing thread on each core.
If CPUs < Max CPUs then
Disable the lowest performing cores first.

If threading is enabled:
If there are less threads enabled than cores do the same logic as when threading disabled.
If there are more threads enabled than cores, then
enable all the fastest threads in each core first.
for each remaining thread, enable the thread from the lowest performing core up.

Given the first step when threading is enabled, is the same when threading is disabled, disabling threading becomes a redundant option. If enabled threads < max cores, threading would effectively be disabled anyway.

The reason for enabling threads from low perf cores up is to improve their ability to handle aggregate workloads and preserve single core perf on the best enabled threads. Also, looking at core perf metrics from a couple of ryzens i have, shows that high perf threads usually cluster in the same core, so enabling those two threads would actually harm single threaded perf. The highest rated cores should be the last to be paired with a thread to maintain highest possible single core perf.

If the cores/threads had a metric for most energy efficient, and energy efficiency was the goal vs max performance, a similar algorithm could be performed using the energy efficiency rating vs the performance rating.

This algorithm would also be helping the scheduler if the kernel scheduler is preferred core aware (such as many current patched kernels and 6.9 will be for ryzens).

The rating would need to be CPU specific, a general fallback would use lscpu MAXMHZ, but thats not accurate for ryzen perf ratings, but it might be sufficient for Intel chips (I don't have any to test), so one would prioritize P cores over E cores, etc.
In the case where there is no CPU specific logic, and lscpu reports equal MAXMHZ, a fallback would rate one core in a multithreaded CPU higher than its neighbor, so that threading is always a last resort.

Switch to ACPI Power Profile

We should drop the ryzenadj power profile in favor of the PPD supported platform_profile

[gamer@opineo acpi]$ pwd
/sys/firmware/acpi
[gamer@opineo acpi]$ cat platform_profile_choices 
low-power balanced performance
[gamer@opineo acpi]$ cat platform_profile
balanced
[gamer@opineo acpi]$ echo performance | sudo tee platform_profile
[sudo] password for gamer: 
performance
[gamer@opineo acpi]$ cat platform_profile
performance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.