https://bugs.kde.org/show_bug.cgi?id=500412

--- Comment #13 from John <[email protected]> ---
Hi guys!
I see that there's an open merge request here:
https://invent.kde.org/plasma/kinfocenter/-/merge_requests/234
To avoid reopening this bug report, I want to give my feedback now.
I don't want just something that "reduces the confusion" as there is no
confusion on my part.
I know exactly much RAM I have in the computer.
And I know that the firmware and the Linux kernel is reserving a part of it,
without telling the userspace tools how much.

It's normal and I don't care about that, I care about what was / is the total,
that has nothing to do with what is reserved!
So, form all my research and a bit of commands modifications, there is one way
to do it that requires superuser privileges:
sudo dmidecode -t memory | awk
'/Size:[[:space:]]No[[:space:]]Module[[:space:]]Installed/ {next}/Size:/ {print
$0}';

I made it skip the lines with 'No Module Installed', as those are empty slots,
but I don't know how to make it sum things if more than one is installed and I
could not test it anyway as I have just one stick or RAM installed.
But since Infocenter -> Memory page also seems to call dmidecode without asking
me for the password, I thing the superuser privileges is not a problem, though
counting and summing up the amounts on every stick probably still is.

And based on these 2 answers here:
https://stackoverflow.com/a/53186875
https://stackoverflow.com/a/76641120
There are 2 ways to calculate it without sudo.

totalmem=0; for mem in /sys/devices/system/memory/memory*; do [[ "$(cat
${mem}/online)" == "1" ]] && totalmem=$((totalmem+$((0x$(cat
/sys/devices/system/memory/block_size_bytes))))); done;
echo $((totalmem/1024**3)) GB \(${totalmem} bytes\);

totalmem=$(lsmem -b --summary=only | sed -ne '/online/s/.* //p');
echo $((totalmem/1024**3)) GB \(${totalmem} bytes\);

If the real total memory size is shown, there is not reason for the tooltip to
even exist, but it's ok if you want to show it how much is available / usable
to the system or to explain that some of it is reserved by the firmware and the
Linux kernel.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to