Bug 478079

Summary: Plasma System Monitor reporting incorrect CPU usage for applications
Product: [Applications] plasma-systemmonitor Reporter: dominickator122102
Component: generalAssignee: KSysGuard Developers <ksysguard-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: ahiemstra, fanzhuyifan, plasma-bugs-null, putr4.s
Priority: NOR Keywords: qt6
Version First Reported In: 5.90.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: As you can see the CPU usage for Firefox is more then the entire system is using.

Description dominickator122102 2023-12-04 20:43:28 UTC
Created attachment 163866 [details]
As you can see the CPU usage for Firefox is more then the entire system is using.

SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

When looking at the Applications menu under the system monitor home page CPU usage is incorrectly reported on a per app basis.

STEPS TO REPRODUCE
1. Open system monitor with Firefox open.
2. Look at the per application cpu usage.

OBSERVED RESULT
Firefox is reporting 9% usage of my CPU when the total CPU usage is shown as just over 6%.

EXPECTED RESULT
The CPU usage for Firefox should not be more then the total CPU usage

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
(available in About System)
KDE Plasma Version: 5.90
KDE Frameworks Version: 5.246.0
Qt Version: 6.6.1

ADDITIONAL INFORMATION
Comment 1 fanzhuyifan 2023-12-05 00:31:19 UTC
I think the CPU usage for the apps is calculated with 100% being fully using a single core, while for the entire system 100% means fully using all the cores in the system.
Comment 2 Arjen Hiemstra 2023-12-05 15:07:04 UTC
https://invent.kde.org/plasma/plasma-systemmonitor/-/merge_requests/242

When using the "scaled" display style (the default) usage should be scaled by the total number of cores. That broke in 6 due to some changes with tables.
Comment 3 Arjen Hiemstra 2023-12-06 11:26:26 UTC
Git commit ec2b8120bc17ab53f3eae08ad157484b3bc82412 by Arjen Hiemstra.
Committed on 06/12/2023 at 12:24.
Pushed by ahiemstra into branch 'master'.

table: Use base delegate text in cell delegates

We want to be able to override the cell text, which hardcoding to
model.display breaks. Instead, we can use the text property of the
delegate and default that to model.display.

M  +2    -0    src/table/BaseCellDelegate.qml
M  +1    -1    src/table/FirstCellDelegate.qml
M  +2    -2    src/table/LineChartCellDelegate.qml
M  +1    -2    src/table/TextCellDelegate.qml

https://invent.kde.org/plasma/plasma-systemmonitor/-/commit/ec2b8120bc17ab53f3eae08ad157484b3bc82412