Bug 497341 - Individual Core Usage incorrectly shows 100% CPU usage, disagreeing with htop and System Monitor
Summary: Individual Core Usage incorrectly shows 100% CPU usage, disagreeing with htop...
Status: REPORTED
Alias: None
Product: ksystemstats
Classification: Frameworks and Libraries
Component: General (show other bugs)
Version: 6.2.4
Platform: NixOS Linux
: NOR major
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-11 23:01 UTC by Andrew Kelley
Modified: 2024-12-27 09:27 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
screenshot (121.57 KB, image/png)
2024-12-11 23:01 UTC, Andrew Kelley
Details
screenshot with htop and system monitor (1.53 MB, image/png)
2024-12-12 22:49 UTC, Andrew Kelley
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Kelley 2024-12-11 23:01:21 UTC
Created attachment 176536 [details]
screenshot

SUMMARY

Individual Core Usage shows wrong data sometimes, incorrectly marking applications as 100% CPU usage when they are idle. Please audit its logic to make sure it matches System Monitor and htop.

This was brought up here and incorrectly dismissed: https://discuss.kde.org/t/individual-core-usage-doesnt-match-top-by-a-lot/9232

STEPS TO REPRODUCE and OBSERVED RESULT

1. Wait for the public release of Ghostty, scheduled for December 31, 2024, or ask Mitchell Hashimoto for a private beta invitation.
2. Follow the steps in the README of that project to build from source.
3. Run the ghostty binary and observe 2 apparently pegged CPU cores per open window.
4. Run htop and notice ghostty actually is idle.
5. Run System Monitor and notice ghostty is actually idle.

EXPECTED RESULT

No bars shown in the Individual Core Usage widget when the app is idling.

SOFTWARE/OS VERSIONS

Operating System: NixOS 24.11
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.8.0
Qt Version: 6.8.0
Kernel Version: 6.12.3 (64-bit)
Graphics Platform: Wayland
Processors: 32 × AMD Ryzen 9 7950X 16-Core Processor
Memory: 62.0 GiB of RAM
Graphics Processor: AMD Radeon RX 7900 XTX

ADDITIONAL INFORMATION

I observed this also in Plasma 5, before upgrading to Plasma 6.2.
Comment 1 Nate Graham 2024-12-12 18:48:43 UTC
The widget doesn't measure apps but rather than whole system. Apps can still be consuming CPU even when they're idle, too.

Can you attach a new screenshot that shows the output of htop and System Monitor disagreeing with what the widget is saying?
Comment 2 Andrew Kelley 2024-12-12 22:49:02 UTC
Created attachment 176567 [details]
screenshot with htop and system monitor

Here is the requested screenshot.
Comment 3 Andrew Kelley 2024-12-12 22:52:53 UTC
To be clear when I use the word "idle" here, I mean "using 0% CPU".
Comment 4 Andrew Kelley 2024-12-26 22:12:41 UTC
Updated steps to reproduce now that ghostty is released as free and open source software:

First, ensure x11 or wayland, libadwaita, pkg-config, and gtk4 development system libraries are installed.

Build from source:

```
wget https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz
tar xf zig-linux-x86_64-0.13.0.tar.xz
git clone https://github.com/ghostty-org/ghostty/
cd ghostty
git checkout v1.0.0
../zig-linux-x86_64-0.13.0/zig build
./zig-out/bin/ghostty
```

Observe 2 apparently pegged CPU cores per open window.
Run htop and notice ghostty actually is idle.
Run System Monitor and notice ghostty is actually idle.
Comment 5 Steven H. 2024-12-27 09:27:30 UTC
For what it's worth I can confirm this happening on my system too:

Operating System: openSUSE Tumbleweed 20241224
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1
Kernel Version: 6.12.6-1-default (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
Memory: 15.5 GiB of RAM
Graphics Processor: AMD Radeon RX 6600 XT
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7C56
System Version: 6.0

Another screenshot that illustrates the problem: https://ibb.co/bzdkbvS 

On the dashboard the CPU usage is constantly at around 17 percent while Ghostty is running (and that is mirrored when using the applet "Individual Core Usage" which shows 2 of 12 cores constantly busy with Ghostty). But the actual list of processes (or htop) show that Ghostty is basically idle at zero percent cpu usage. 

This is the first time I've seen this happen though. No other software than Ghostty leads to this false reporting of cpu usage.