Improved performance of the cpu widget #246
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.