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
Per-meter display types #1387
Per-meter display types #1387
Conversation
|
Available characters (Unicode):
Kinda inspired by graphs like this:
I'm aware of that. Just noting that for some information (like Disk IO and Network Bandwidth) a simple in/out display (cf. first item in this list) makes more sense. It's not as if you can't have both #714 style graphs and simple in/out graphs for meters where they make sense. What this PR mostly does is to allow meters to disable display formats that just don'e make sense (like graph display on the SysArch meter).
ACK, missed that one in my listing above … In the PR it's already included AFAICS.
As I'd suggest to keep the old style, the one implemented in #714 simple would become a new bit (
This makes for very interlinked code when additional constraints emerge. This also doesn't cover the clock/date meters as they contain the time of day as one item value.
Whether LED mode makes sense or not is mostly dependent on the displayed text. For Clock/Date/Uptime meters it's sensible, while for the SysArch meter it's not. Having this handled in a "support flag set" has the big advantage that you can simply handle switching modes in one place. Having additional flags would require
|
The "pixel gaps" were from the bug I left in #714 .
|
I guessed so. Just remarked on it for completeness.
I can see this meter mode for at least Disk I/O, Network I/O; possibly other meters where the notion of two opposite directions of flow/values makes sense. But TBH, even if this mode was only used for like two metrics, this could already be quite useful.
No need: Just grab the first two values and display them. Nothing you couldn't reuse with the "stacked" mode, where instead of only the first two you'd just use all of them.
Shouldn't be too hard to figure something for that case.
ACK. Would be confusing otherwise. Could even be log10 per (Braille) pixel, with the "zero line" always drawn. Gives 7 orders of magnitude for display and with 10K being the baseline (unless there's need to scale further) could display a full-duplex 1GbE link.
I'd even argue only meters with two items should use this meter.
ACK. NP. That's how I'd've gone about it too. NB: Maybe split further discussion into it's own issue/PR, so we can stick to the meter mode rework in this PR. |
Sure.
My idea was to remove the item values totally, so that
My point is you already special-cased |
ACK.
Can you elaborate? I didn't touch anything related to the |
581116e
to
e9f7d25
Compare
Allow me to restate my concerns about this PR? Generally I don't like the idea of having a per-meter
And finally I don't think there would be a lot of new meter modes in htop. (Maybe "micro-text" mode and "Graph2" mode, but probably not more.) |
I think, even for graph mode 1a/1b vs. 2 it's not that clear cut even though the gm2 is mostly a special case. Not all data you can stack in modes 1a/1b makes sense as an in/out style graph in mode 2. Re 1a/1b/2: Mode 1a is basically the current implementation with the graph just showing the total value over time and 1b being the new implementation in #714. Mode 2 being #1390. They are distinct and so is their set of use cases. I'll have to take another look at the ustom meter modes, but AFAIR the only use I currently remember is with the CPU meters; and those allow for text. Will have to take another look there, but I doubt that's something that fully breaks this usage. |
@BenBE When I wrote #714 I intended the mode to replace the current graph mode implementation, not as an alternative "1a/1b" as you say. I think you are referring to #928 instead. When a meter supports a single "summary" value, we can plot that one instead of the stacked colors. With #928 in mind, there would be three graph display modes:
|
e9f7d25
to
63cba2e
Compare
Another aspect for this PR is that "per mode checks" are difficult to iterate through automatically. Also, basically we are already using an implicit bitmap of "all supported" right now. |
I'm curious about one thing. Since this patch would disable certain modes for certain meters, what would happen if the user has an htop configuration that sets a meter to a mode that is no longer "supported" in the newer version of htop? |
With the new patch htop would silently select the next supported mode in order. |
ecf8b68
to
27bb96b
Compare
I have some experimental changes that you could consider merging with this feature. See this branch: In particular, these two commits: |
27bb96b
to
564700d
Compare
@Explorer09 Please check this updated patchset. I think there broke something on rebase. |
564700d
to
cfca5f6
Compare
cfca5f6
to
6b2d2b3
Compare
@Explorer09 I pulled in your patches (took me a bit to compare with what I already had). LGTM. I noticed a small issue with the LED mode of the Battery meter: When you switch from LED mode to Text mode, you see the LED mode text until the next refresh cycle happened. To resolve this, we could: a) just refresh rendering when a mode is changed Anyway: The LED mode of the battery meter looks a bit cramped ( |
I think this should be a separate issue. I would vote for a force refresh when a mode is changed (a).
I would choose to make the space also in text mode. (There's no reason against that). |
@BenBE By the way. I feel little uncomfortable when we allow a |
6b2d2b3
to
c75e4d7
Compare
Okay, best idea where to place this?
The space is there in Text mode, but missing in LED mode. Text mode: |
We could |
When a meter mode in changed in the UI, that is
The lack of space is probably due to bar drawing. Considering CPU meters already use spaces to separate frequency and temperature fields, it won't look visually inconsistent if we insert a space for Battery meter as well. |
It's a matter of the displayed text being cached and still wrong. There is a redraw done already.
ACK. |
Or maybe call Meter.draw() to force updating the cache? I don't know. |
Please pull in these two patches to your PR: |
@Explorer09 Anything else to do in your opinion? Otherwise I'd go ahead an merge this one soon … |
This allows meters to limit the available display modes/styles based on a bit mask for each meter class. Doing so allows to disable display modes that make little or no sense for a specific meter. Co-authored-by: Benny Baumann <BenBE@geshi.org> Co-authored-by: Kang-Che Sung <explorer09@gmail.com>
Limit display to Text mode only for: * BlankMeter * HostnameMeter * SELinuxMeter (Linux) * SysArchMeter * SystemdMeter (Linux) Co-authored-by: Benny Baumann <BenBE@geshi.org> Co-authored-by: Kang-Che Sung <explorer09@gmail.com>
This disables graphing and bar mode display for: * ClockMeter * DateMeter * DateTimeMeter * UptimeMeter Co-authored-by: Benny Baumann <BenBE@geshi.org> Co-authored-by: Kang-Che Sung <explorer09@gmail.com>
This reduces code size by not needing to check if 'supportedModes' is zero.
407e247
to
cf7f822
Compare
This PR restricts the list of available Meter display options to the ones that are sensible in the context of each meter (AKA "supported").
Given that some meters mostly represent textual information anyway (Hostname, System Information) or have monotonically increasing values anyway (Clock, Date, DateTime) there's not much sense, providing graphs for these.
Another application for this PR is regarding #714 to provide a multi-graph option for Network and Disk I/O. This would allow to show a special graph that displays a second data series downwards instead of stacked on top (@eworm-de @Explorer09 : That's what I'd prefer for Disk IO and Network IO meters at least).