Bug 245293 - KSysGuard RAM usage summary doesn't match the real time plot
Summary: KSysGuard RAM usage summary doesn't match the real time plot
Status: Closed Works As Intended
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: freebsd-kde (Team)
Depends on:
Reported: 2020-04-02 19:24 UTC by jdrch
Modified: 2020-07-01 05:16 UTC (History)
3 users (show)

See Also:

KSysGuard Screenshot (67.76 KB, image/png)
2020-04-02 19:24 UTC, jdrch
no flags Details
Config file with application memory (1.54 KB, application/x-ksysguard)
2020-06-30 12:59 UTC, Adriaan de Groot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description jdrch 2020-04-02 19:24:43 UTC
Created attachment 212989 [details]
KSysGuard Screenshot

KSysGuard RAM usage plot and summary at the bottom of the window often don't agree. See screenshot with the plot showing 15.1 GB of RAM used while the bottom summary says only 6.1 GB. The machine's performance as I submit this bug from it leads me to believe the bottom number is the more accurate one.
Comment 1 Adriaan de Groot freebsd_committer 2020-06-26 19:25:36 UTC
Required to reproduce:

- start ksysguard (eg. from command-line)
- settings -> tick the "show statusbar" box to show the bottom bar 

My statusbar shows `5.3 GiB / 31.9 GiB` while the graph shows `28.4 GiB / 31.9 GiB`. Top tells me

Mem: 1917M Active, 3458M Inact, 744M Laundry, 22G Wired, 1559M Buf, 3586M Free
ARC: 11G Total, 7380M MFU, 2827M MRU, 128K Anon, 157M Header, 487M Other
     8785M Compressed, 12G Uncompressed, 1.40:1 Ratio

So all my memory is in used, but only 5.4 GiB (active + inact) is "really" used according to top. I think there's mostly a mismatch between which numbers are being used.
Comment 2 Adriaan de Groot freebsd_committer 2020-06-30 12:57:38 UTC
The default tabs are defined in (XML) files like `SystemLoad2.sgrd`. Assuming you have a normally-installed ksysguard, you have a `/usr/local/share/ksysguard/SystemLoad2.sgrd` from packages. Once you've run ksysguard, a copy is made locally, in `~/.local/share/ksysguard/SystemLoad2.sgrd`.

The contents of the "default" tab come from this file (similarly, there's a processlist .sgrd file for the other standardized tab in ksysguard). This file -- both in the package and probably your  local copy -- uses the sensor *mem/physical/used* which is .. total physical memory used. The status bar shows a different sensor value, namely *mem/physical/application*.

While I could change things in packaging -- e.g. adding a sensor, or changing the two default ones -- that wouldn't help **you** because you already have a copy of the file, and ksysguard defers to that one.

I'm going to attach an alternate `SystemLoad2.sgrd` file to this bug report. You can copy it into your local area (overwrite the existing one while ksysguard isn't running) and when you restart ksysguard you get a graph with **three** lines, of which the first (blue-ish) matches the statusbar value and which indicates more accurately how your applications are doing.

I'm a bit hesitant to push this to packaging or as default anywhere, because it adds lines (perhaps visual noise) and because there's 3 sensors in the graph now, you lose the ".. of XXX" additional information. You could always remove the second line -- on FreeBSD you'll almost always have the *physical/used* sensor maxed out, just because ZFS ARC will eat up everything you have left. Then you don't see overall memory pressure though.

I'll close this issue shortly, and in the meantime point you to https://bugs.kde.org/show_bug.cgi?id=404637 which asks that this default tab be editable -- which it should be, since you have a local copy anyway.
Comment 3 Adriaan de Groot freebsd_committer 2020-06-30 12:59:43 UTC
Created attachment 216069 [details]
Config file with application memory

Copy this SystemLoad2.sgrd file into `~/.local/share/ksysguard/` to change the default memory graph.
Comment 4 jdrch 2020-07-01 05:16:57 UTC
Thanks Adriaan! I did as you said and really like the results.

Also appreciate the ZFS ARC explanation. Is this peculiar to FreeBSD's OpenZFS implementation, or common to all of them?