Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflect the "show cached memory" setting in help screen #1584

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Explorer09
Copy link
Contributor

Hide the "buffers/cache" text on the memory bar description when the "show cached memory" setting is off.

@BenBE
Copy link
Member

BenBE commented Jan 9, 2025

I wonder if we should completely hide these – or similar to how threads/kernel threads are handled on the main screen – simply use the shadow color to remove emphasis. Still showing them keeps these values "discoverable" to the user.

Apart from that LGTM.

@BenBE BenBE added enhancement Extension or improvement to existing feature needs-discussion 🤔 Changes need to be discussed and require consent labels Jan 9, 2025
@BenBE BenBE added this to the 3.4.0 milestone Jan 9, 2025
@fasterit
Copy link
Member

fasterit commented Jan 9, 2025

may be add a hint why cache is not shown?

diff --git a/Action.c b/Action.c
index ed61881a..27daf976 100644
--- a/Action.c
+++ b/Action.c
@@ -749,7 +749,7 @@ static Htop_Reaction actionHelp(State* st) {
       addbartext(CRT_colors[MEMORY_CACHE], "/", "cache");
       addbartext(CRT_colors[BAR_SHADOW], "          ", "used");
    } else {
-      addbartext(CRT_colors[BAR_SHADOW], "                        ", "used");
+      addbartext(CRT_colors[BAR_SHADOW], "/cache hidden in setup  ", "used");
    }
    addbartext(CRT_colors[BAR_SHADOW], "/", "total");
    addattrstr(CRT_colors[BAR_BORDER], "]");

@Explorer09
Copy link
Contributor Author

I wonder if we should completely hide these – or similar to how threads/kernel threads are handled on the main screen – simply use the shadow color to remove emphasis. Still showing them keeps these values "discoverable" to the user.

I'm okay with using a shadow color on the text meter mode of the memory meter to hint the fact they are hidden. But on the help screen, the colors of the "buffers" and "cache" words would (in my humble opinion) confuse users when they are never shown at all.

My idea on this change is similar to the "detail CPU time" setting - when an item is not shown in the CPU meter bar that item's description would also be hidden in the help screen.

may be add a hint why cache is not shown?
addbartext(CRT_colors[BAR_SHADOW], "/cache hidden in setup ", "used");

If we need that hint, then we should probably hint about detailed CPU time, too.

Remember the reason we add an option to hide "buffers" and "cache" from the memory bars is that they don't add to the total "used" memory size. The "buffers" and "cache" can be freed up on demand when additional memory is needed for processes or kernel. If a user doesn't think they should be shown on the memory bar, we gave them this choice.

Regression from b29b33e
The misaligned text is only seen on non-Linux systems.
Hide the "buffers/cache" text on the memory bar description when the
"show cached memory" setting is off.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
@Explorer09 Explorer09 force-pushed the help-screen-memory-bar branch from cdd6c98 to 3daf1bc Compare January 10, 2025 21:32
@BenBE
Copy link
Member

BenBE commented Jan 11, 2025

I wonder if we should completely hide these – or similar to how threads/kernel threads are handled on the main screen – simply use the shadow color to remove emphasis. Still showing them keeps these values "discoverable" to the user.

I'm okay with using a shadow color on the text meter mode of the memory meter to hint the fact they are hidden. But on the help screen, the colors of the "buffers" and "cache" words would (in my humble opinion) confuse users when they are never shown at all.

I wouldn't change anything about the normal meter display for any of the meters. Just with the help screen.

My idea on this change is similar to the "detail CPU time" setting - when an item is not shown in the CPU meter bar that item's description would also be hidden in the help screen.

For the detailed CPU time we could do the same on the help screen. Wouldn't mind.

may be add a hint why cache is not shown?
addbartext(CRT_colors[BAR_SHADOW], "/cache hidden in setup ", "used");

If we need that hint, then we should probably hint about detailed CPU time, too.

ACK.

Remember the reason we add an option to hide "buffers" and "cache" from the memory bars is that they don't add to the total "used" memory size. The "buffers" and "cache" can be freed up on demand when additional memory is needed for processes or kernel. If a user doesn't think they should be shown on the memory bar, we gave them this choice.

While the details are opposites for these two settings, the overall handling of these should probably be consistent. Which means if we remark the existence of one when hidden, we should also hint about the other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Extension or improvement to existing feature needs-discussion 🤔 Changes need to be discussed and require consent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants