GithubHelp home page GithubHelp logo

haptein / powerplan Goto Github PK

View Code? Open in Web Editor NEW
31.0 4.0 2.0 150 KB

License: BSD 3-Clause "New" or "Revised" License

Python 98.21% Shell 1.79%
automation power-management daemon configurable battery-life performance linux cli

powerplan's People

Contributors

haptein 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

powerplan's Issues

Turb doesn't turn off after laptop unplugged from power

It worked just fine at first, but then I ran sudo powerplan --daemon then it stopped disabling turbo automatically after unplugging the power. I don't know for certain that that was the cause, but it just started happening after that. I don't know how to pull logs for this, but let me know what I'd need to do to help.
System Info:
Operating System: KDE neon 5.22
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.3
Kernel Version: 5.11.0-37-generic (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-8550U CPU @ 1.80GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620

Thanks

EDIT: I've tried it several times. Uninstalled powerplan and reinstalled it, and it worked as it should every time, but every time I ran sudo powerplan --daemon, this issue occurs.

Screenshot_20211008_222035

GUI

Continuing off from the discussion started in #1 by @KarkanAlzwayed.

I actually planned for powerplan to get a profile edition (and perhaps some status plotting/monitoring) GUI at some point, but truth be told, at this point in time I'm not really experienced in writing pretty desktop GUI's and there's still other powerplan features I'd like to implement first. I actually had a look at QtDesigner a while ago and it seemed like a good starting point. If anyone has some framework/library recommendations or would like to give it a go that'd be great!

@KarkanAlzwayed By all means feel free to try! I think Open-Source projects like this are a great way to learn new things, and I'd be happy to do some code review and offer help if needed. If you end up deciding to give it a go, I think good places to start are the classes PowerProfile and CPUSpec. The main project structure is outlined simply here.

[Bug] IndexError: tuple index out of range in cpu.py

Description
if i start powerplan on my Intel(R) Core(TM) i5-3550, i get the error:

Traceback (most recent call last):
File "/usr/bin/powerplan", line 10, in
import status
File "/opt/powerplan/src/status.py", line 8, in
import cpu
File "/opt/powerplan/src/cpu.py", line 418, in
CPU = CPUSpec()
File "/opt/powerplan/src/cpu.py", line 84, in init
self.sibling_cores_repr = ' '.join([f"{sib[0]}-{sib[1]}" for sib in self.thread_siblings])
File "/opt/powerplan/src/cpu.py", line 84, in
self.sibling_cores_repr = ' '.join([f"{sib[0]}-{sib[1]}" for sib in self.thread_siblings])
IndexError: tuple index out of range

my cpu is old, really old. Only 1 thread per core. I think powerplan expects always 2 threads.

Additional info:
ouput of lscpu:

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 36 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Vendor ID: GenuineIntel
Model name: Intel(R) Core(TM) i5-3550 CPU @ 3.30GHz
CPU family: 6
Model: 58
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
Stepping: 9
CPU max MHz: 3700,0000
CPU min MHz: 1600,0000
BogoMIPS: 6797.62
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 syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good
nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f1
6c rdrand lahf_lm cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm ida arat pln pts md_clear flush_l1d
Virtualization features:
Virtualization: VT-x
Caches (sum of all):
L1d: 128 KiB (4 instances)
L1i: 128 KiB (4 instances)
L2: 1 MiB (4 instances)
L3: 6 MiB (1 instance)
NUMA:
NUMA node(s): 1
NUMA node0 CPU(s): 0-3
Vulnerabilities:
Itlb multihit: KVM: Mitigation: VMX disabled
L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT disabled
Mds: Mitigation; Clear CPU buffers; SMT disabled
Meltdown: Mitigation; PTI
Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Spectre v2: Mitigation; Full generic retpoline, IBPB conditional, IBRS_FW, STIBP disabled, RSB filling
Srbds: Vulnerable: No microcode
Tsx async abort: Not affected

Is it possible to integrate powerplan into KDE's panel and settings?

I hope I will make sense, but here it is.
On kde, when I install power-profiles-daemon, kde would detect it and add a section for it in the panel and the settings, where I can switch profiles directly from the panel, and also set default profiles when power is plugged/unplugged. Could something similar possibly be done with powerplan via a package that I can download? A script that I can run? A merge/pull request or something you developers do?
It is a really nice feature, but I just can't use power-profiles-daemon(PFD) over powerplan, because PFD makes my laptop's fans go bananas after the power is plugged in. Powerplan doesn't do that.
See screenshots, please

Panel integration
panel

settings integration
To make changes while on AC or battery power
when on battery

To set default profiles when on AC or battery power (power plugged/unplugged)
switch

Issues with using arguments with powerplan

Hello! - I've just installed powerplan on my Manjaro laptop, using the instructions of the readme:

git clone https://github.com/Haptein/powerplan.git
cd powerplan && sudo ./install

No issues seemed to occur during install. However, when trying to use any feature of powerplan (for example, powerplan --version), I get the following errors:

Traceback (most recent call last):
  File "/usr/bin/powerplan", line 10, in <module>
    import status
  File "/opt/powerplan/src/status.py", line 8, in <module>
    import cpu
  File "/opt/powerplan/src/cpu.py", line 442, in <module>
    CPU = CPUSpec()
  File "/opt/powerplan/src/cpu.py", line 59, in __init__
    self.crit_temp = int(psutil.sensors_temperatures()[self.temp_sensor][0].critical)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

I have Python 3.9.7-1 installed, and have python-psutil 5.8.0-1 installed. (After first getting the errors, I tried installing psutil with pip install psutil just to make sure it was installed, not sure if that was necessary. (The package did install correctly though, so it doesn't seem like a psutil issue))

This is my first issue on Github, apologies if there are any formatting errors. :)

powerplan -s shows a different battery policy than what's set in powerplan.conf

Description
A clear and concise description of what the bug is.
In the output of sudo powerplan -s, it was showing the policy as balance_power no matter what I did in the powerplan.conf file.
I think it started happening after I ran powerplan --persistent, then it corrected itself after a couple of reboots. Now it is showing the correct thing. I still want to know why it did that at first.
Additional info:
Please include the output of "powerplan --system" and your powerplan.conf file (if relevant to issue)

System
    OS:                 Linux-5.14.10-1-MANJARO-x86_64-with-glibc2.33
    powerplan:          0.8.5 running on Python3.9.7 with psutil5.8.0
    CPU model:          Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Core configuraton:  4/8  0-4 1-5 2-6 3-7
    Frequency range:    400000 - 1800000 - 4000000
    Driver:             intel_pstate
    Turbo:              /sys/devices/system/cpu/intel_pstate/no_turbo
    Governors:          performance, powersave
    Policies:           default, performance, balance_performance, balance_power, power
    Temperature:        acpitz, pch_skylake, iwlwifi_1, *coretemp
    AC adapter:         AC
    Battery:            BAT0

powerplan.conf:

[DEFAULT]
priority = 99
ac_pollingperiod = 1000
bat_pollingperiod = 2000
ac_cores_online = 4
bat_cores_online = 4
ac_templimit = 95
bat_templimit = 95
ac_minfreq = 400
ac_maxfreq = 4000
bat_minfreq = 400
bat_maxfreq = 3000
ac_minperf = 1
ac_maxperf = 100
bat_minperf = 1
bat_maxperf = 96
ac_tdp_sustained = 30
ac_tdp_burst = 45
bat_tdp_sustained = 10
bat_tdp_burst = 16
ac_turbo = True
bat_turbo = False
ac_governor = powersave
bat_governor = powersave
ac_policy = balance_performance
bat_policy = power
triggerapps = 

Screenshot_20211025_222719
.

There should be a "balanced" policy!

Is your feature request related to a problem? Please describe.
There are only these policies ['default', 'performance', 'balance_performance', 'balance_power', 'power']

Describe the solution you'd like
A balance policy would be great, because power makes the laptop too slow and things lag a lot, the balance_power is ok, but things still lag a bit, especially Firefox, and balance_performance and performance consume too much battery. If the default one is balance one, and the balance_power and balance_performance adjust themselves automatically (in which case I didn't notice that) then you can just disregard this request.

Describe alternatives you've considered
balance_power

Additional context
This gives an error, which indicates that there is no balance policy.
Screenshot_20211008_222035

switch between cpu power configurations depending on the current workload

I would like to test to switch power configs on current workload or something similar.

e.g. mpv Video Player

if it plays a video and use hardware decoding, it does not need much cpu power -> powersave profile
But if it has to play a 8K AV1 Video, no HW support for AV1, it falls back to software decoding -> performance profile

Do you plan to add switching on usage? (i am not sure, if usage is the best value for it - e.g. single core program, that utilise only 1 core with 100%, other 1-2%)

AttributeError: 'Battery' object has no attribute 'charge_now'

Description
After the update to newest git version, i get the error on my desktop system (no battery):

sudo powerplan --status
Traceback (most recent call last):
File "/usr/bin/powerplan", line 157, in
main_loop(monitor_mode, system=system)
File "/usr/bin/powerplan", line 51, in main_loop
status = systemstatus.StatusMonitor(system, profiles)
File "/opt/powerplan/src/systemstatus.py", line 247, in init
super().init(system, profiles, fields)
File "/opt/powerplan/src/systemstatus.py", line 92, in init
self.field_methods = self._get_field_methods(fields=fields, custom_fields=custom_fields)
File "/opt/powerplan/src/systemstatus.py", line 127, in _get_field_methods
battery_charge_now=(self.battery.charge_now, {}),
AttributeError: 'Battery' object has no attribute 'charge_now'

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.