Bug 482719 - CPU core label collapses in the wrong way when there's not enough space
Summary: CPU core label collapses in the wrong way when there's not enough space
Status: RESOLVED FIXED
Alias: None
Product: plasma-systemmonitor
Classification: Applications
Component: general (other bugs)
Version First Reported In: 6.0.1
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: KSysGuard Developers
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-03-07 14:18 UTC by Hesam Gholami
Modified: 2024-05-22 22:49 UTC (History)
3 users (show)

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


Attachments
Systerm monitor history page showing inconsistent labels for cores more after 10th (114.20 KB, image/png)
2024-03-07 14:18 UTC, Hesam Gholami
Details
Making window wider will fix the issue (111.27 KB, image/png)
2024-03-08 13:35 UTC, Hesam Gholami
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hesam Gholami 2024-03-07 14:18:21 UTC
Created attachment 166591 [details]
Systerm monitor history page showing inconsistent labels for cores more after 10th

SUMMARY
In system monitor application there is a history section which shows a history of CPU core utilization. For every cpu core it assigns a color and a label like 'Core 1 Total Usage %1.0'. For cpus that have more than 10 cores, it uses another label like this: 'Usage 1.0%'

I've attached an image to better describe the error.

I'm pretty sure this was not the case in Plasma 5 and I'm seeing this in Plasma 6.0.1.

STEPS TO REPRODUCE
1. A cpu with more than 10 cores
2. Open up system monitor application
3. Navigate to History tab

OBSERVED RESULT
CPU core labels after 10th core are different from previous ones.

EXPECTED RESULT
CPU core labels after the 10th one also should be same as previous ones.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.1
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.7.8-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 20 × Intel® Core™ i9-10900 CPU @ 2.80GHz
Memory: 62.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1650/PCIe/SSE2
Manufacturer: ASUS

ADDITIONAL INFORMATION
N/A
Comment 1 Nate Graham 2024-03-07 21:31:19 UTC
If you make the window wider, do the labels change?
Comment 2 Hesam Gholami 2024-03-08 13:35:35 UTC
Created attachment 166713 [details]
Making window wider will fix the issue

Making window wider will fix the problem
Comment 3 Hesam Gholami 2024-03-08 13:38:59 UTC
Yes If I make the window wider it will show the labels. the problem is it takes one characters for 1 to 9 and two characters for 10 to 20. So I think the proper solution is to pad 1 to 9 with an additional space if cpu cores are more than 10. So it will be like this:

Core   1 Total Usage %1.0 --> notice additional space for padding here
Core 10 Total Usage %1.0
Comment 4 Nate Graham 2024-03-08 20:41:32 UTC
It looks like the collapse behavior is wrong here. It's truncating the left side of the string instead of the right.
Comment 5 Bug Janitor Service 2024-03-28 08:31:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/ksystemstats/-/merge_requests/81
Comment 6 Arjen Hiemstra 2024-05-22 09:09:24 UTC
Git commit f4b57a9f8c0bb51388b608d3cd55f54d382a7743 by Arjen Hiemstra, on behalf of Zhangzhi Hu.
Committed on 22/05/2024 at 09:09.
Pushed by ahiemstra into branch 'master'.

Fix collapse behavior of CPU usage per core

The collapse behavior of CPU usage per core is incorrect.

For an example, when space is insufficient, "Core 1 Total Usage 1.0%" will collapse into "Usage 1.0%", which is hard to distinguish among different cores.

Therefore, we should make it collapses into core No. (such as "Core 1").

M  +6    -6    plugins/cpu/cpu.cpp

https://invent.kde.org/plasma/ksystemstats/-/commit/f4b57a9f8c0bb51388b608d3cd55f54d382a7743