Bug 440310 - In plasma-systemmonitor, on 12-thread CPU, "Core 11" and "Core 12" sensors sort above "Core 3"
Summary: In plasma-systemmonitor, on 12-thread CPU, "Core 11" and "Core 12" sensors so...
Status: RESOLVED FIXED
Alias: None
Product: plasma-systemmonitor
Classification: Applications
Component: general (other bugs)
Version First Reported In: 5.22.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KSysGuard Developers
URL:
Keywords:
: 453192 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-07-26 21:36 UTC by nyanpasu64
Modified: 2022-06-13 16:27 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 5.26
Sentry Crash Report:


Attachments
Screenshot of the CPUs sensor group list. (15.21 KB, image/png)
2021-07-26 21:36 UTC, nyanpasu64
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nyanpasu64 2021-07-26 21:36:06 UTC
Created attachment 140345 [details]
Screenshot of the CPUs sensor group list.

SUMMARY
On my 12-thread CPU, when I try adding CPU statistics to a plasma-systemmonitor graph, the sorting order of my CPU cores is incorrect.

STEPS TO REPRODUCE
1. Open plasma-systemmonitor.
2. Click "Add New Page..." and "Add".
3. Click the "System Monitor Sensor", and in the right sidebar, click Total Sensors or Sensors.
4. Click "CPUs" and look at the list of sensor groups.

OBSERVED RESULT
The sort order is "All, Core 1, Core 2, Core 11, Core 12, Core 3..., Core 10, [Group] CPU".

EXPECTED RESULT
Cores are sorted in numeric order (I think)?

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2
Kernel Version: 5.13.4-zen2-1-zen (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GT 730/PCIe/SSE2

ADDITIONAL INFORMATION
I don't know where the order comes from, or if there's a technical explanation for the strange order. I don't think the 5600X is NUMA, so that shouldn't be it.
Comment 1 David Redondo 2021-07-27 09:41:46 UTC
We sort the ids lexicographic, what we should do is sort the visible strings
Comment 2 Bug Janitor Service 2021-08-30 08:04:00 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/ksystemstats/-/merge_requests/15
Comment 3 Arjen Hiemstra 2022-05-06 11:47:41 UTC
*** Bug 453192 has been marked as a duplicate of this bug. ***
Comment 4 Arjen Hiemstra 2022-06-13 14:59:23 UTC
Git commit debcb7ce19068fb5798c343d3bd572eaef4de0a7 by Arjen Hiemstra.
Committed on 13/06/2022 at 14:49.
Pushed by ahiemstra into branch 'master'.

Sensors: Port SensorTreeModel to std::map so we can use a custom compare

Currently, the tree ends up being sorted with numbers sorted as
characters. Since the sorting happens in the map, if we want to sort
things differently we need to override the sorting function. QMap does
not support that so use std::map instead with a custom compare object.

M  +56   -21   sensors/SensorTreeModel.cpp

https://invent.kde.org/plasma/libksysguard/commit/debcb7ce19068fb5798c343d3bd572eaef4de0a7