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

fixed bug 1630: wrong CPU values when no ${top *} var was used #1631

Closed
wants to merge 1 commit into from

Conversation

ToyKeeper
Copy link

Fixes bug #1630

This fix detects the /proc/stat format the first time it's accessed... which, in turn, fixes incorrect CPU usage values in Linux.

Checklist

  • I have described the changes
  • I have linked to any relevant GitHub issues, if applicable
  • Documentation in doc/ has been updated
  • All new code is licensed under GPLv3

brndnmtthws#1630

My per-core CPU values were wrong because Conky was ignoring half the data in /proc/stat.

In Linux, Conky supports short and long /proc/stat formats. The type is auto-detected by determine_longstat_file(). However, this function is only called if the user's config uses a ${top *} var. If the user doesn't use this widget, the CPU values are calculated wrong because 4 of the 8 stat values are ignored.

In my case, I discovered it because conky showed one of my CPU cores pegged at 100% all the time no matter what. But htop + btop showed under 5% for that core. So I did some digging, and found it was happening because that core was stuck in iowait due to a hung NFS mount.

Conky normally handles iowait correctly, but only if it detected the long stat format. I didn't have any ${top *} vars, so conky wasn't trying to detect the stat format, defaulting to short stat which ignores half the data, and this made it think the CPU was always at 100%.

This fix detects the stat format the first time it's accessed, regardless of which widgets the user config contains.
@netlify
Copy link

netlify bot commented Sep 30, 2023

Deploy Preview for conkyweb canceled.

Name Link
🔨 Latest commit 8da174c
🔍 Latest deploy log https://app.netlify.com/sites/conkyweb/deploys/6518656b466dad00071fff2e

@github-actions github-actions bot added the sources PR modifies project sources label Sep 30, 2023
@brndnmtthws
Copy link
Owner

Superseded by #1632.

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

Successfully merging this pull request may close these issues.

2 participants