TheME
November 29, 2023, 8:23am
1
After running pi-hole for some time, I observe the following warning every second in FTL.log
:
calc_cpu_usage() failed: No error information
The entire log down to the bottom is flooded with this message.
I am running DietPi v8.24.1
(latest) on a NanoPi Neo , but do not have any issues on the dashboard. Even the CPU utilisation display works as expeted.
There's only pi-hole v6 running there, nothing else.
My current versions are
dietpi@DietPi:~$ pihole -v Pi-hole version is development-v6 v5.17.1-221-g2338c9e9 (Latest: v5.17.2) web version is development-v6 v5.19-546-g4ed958db (Latest: v5.21) FTL version is development-v6 vDev-0198329 (Latest: v5.23)
DL6ER
December 3, 2023, 8:15pm
4
Sorry for the long delay. The proposed bugfix is:
pi-hole:development-v6
← pi-hole:tweak/cpu_usage
opened 08:13PM - 03 Dec 23 UTC
# What does this implement/fix?
Following [a report on Discourse](https://dis… course.pi-hole.net/t/calc-cpu-usage-failed-in-ftl-log/66617), we change how FTL computes its own CPU utilization. The issue is that our current method of using the system-provided function `clock()` can easily overflow on 32bit systems, leading to a permanent failure after little more than two days.
This PR changes this to use resource details obtained from the kernel to compute a ten minute average of FTL's CPU utilization based on the consumed CPU time, instead. This is a very reliable metric and more in-line with what `top` and friends calculate for the processes.
---
**Related issue or feature (if applicable):** N/A
**Pull request in [docs](https://github.com/pi-hole/docs) with documentation (if applicable):** N/A
---
**By submitting this pull request, I confirm the following:**
1. I have read and understood the [contributors guide](https://docs.pi-hole.net/guides/github/contributing/), as well as this entire template. I understand which branch to base my commits and Pull Requests against.
2. I have commented my proposed changes within the code.
3. I am willing to help maintain this change if there are issues with it later.
4. It is compatible with the [EUPL 1.2 license](https://opensource.org/licenses/EUPL-1.1)
5. I have squashed any insignificant commits. ([`git rebase`](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html))
## Checklist:
- [x] The code change is tested and works locally.
- [x] I based my code and PRs against the repositories `developmental` branch.
- [x] I [signed off](https://docs.pi-hole.net/guides/github/how-to-signoff/) all commits. Pi-hole enforces the [DCO](https://docs.pi-hole.net/guides/github/dco/) for all contributions
- [x] I [signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) all my commits. Pi-hole requires signatures to verify authorship
- [x] I have read the above and my PR is ready for review.
Details therein.
TheME
December 4, 2023, 12:23am
5
Thanks a lot. I switched over to the tweak/cpu_usage
branch for testing...
1 Like
DL6ER
December 6, 2023, 7:07pm
6
Please switch back to development-v6
, this branch has been merged.
1 Like