Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved performance of the cpu widget #246

Merged
merged 2 commits into from
Apr 9, 2021

Conversation

atopion
Copy link
Contributor

@atopion atopion commented Mar 22, 2021

Hi,
first of all, thank you very much. Your project is amazing.

However, just like #120 I did notice a rather high cpu load of the cpu widget.
When adding this widget, my awesome process averages at 15-20 %, compared to 0-3 % when it is not added (measured with htop).

After looking into the code, I noticed that the widget is constantly parsing the output of the ps command, even when the popup is not opened (which should be the case most of the time after all).
I therefore wrote this modification, where the widget runs a different command while the popup is closed, one that only reads in the first cpu line of /proc/stat and parses it. When the popup is opened, the other command is run, while it is open, so there is no loss of functionality.
The only caveat is, that this modification is increasing the opening time of the popup a little bit, but this is barely noticeable.

With this new modification, I was able to get the cpu load of the awesome process down to about 2-3.5 % while the popup is closed (again measured with htop).

Kind regards.

command that is run while the popup is visible, therefore improved
performance while the popup is invisible.
@streetturtle streetturtle merged commit fc02930 into streetturtle:master Apr 9, 2021
@streetturtle
Copy link
Owner

This is super cool! Thank you very much 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants