-
-
Notifications
You must be signed in to change notification settings - Fork 531
Two-channel graph (Graph2) meter style #1415
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
Open
Explorer09
wants to merge
7
commits into
htop-dev:main
Choose a base branch
from
Explorer09:graph-with-neg
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f47a975 to
745f394
Compare
745f394 to
af6b927
Compare
31cb513 to
bedca8f
Compare
ade4922 to
54d3d1c
Compare
728ef87 to
3033b1d
Compare
aa96aa4 to
10bb617
Compare
10bb617 to
8ab21e9
Compare
8ab21e9 to
30691c9
Compare
f57affb to
5e3eeb1
Compare
b5560f5 to
8a8cfda
Compare
8a8cfda to
eac20b6
Compare
c7c11bc to
b446269
Compare
b446269 to
a84d790
Compare
b9b525e to
d1623cd
Compare
2a785b5 to
19a9056
Compare
8b55f27 to
200df88
Compare
200df88 to
62ad9d3
Compare
beb5b3a to
983b642
Compare
f197d8a to
2bf8ae1
Compare
606ea67 to
dd3e180
Compare
c275287 to
f910395
Compare
Round the graph meter's dynamic scale to a power of two and print the graph scale. For a percent graph, a "%" character is printed in place of the scale. Signed-off-by: Kang-Che Sung <[email protected]>
This is a prerequisite for the feature "Graph meter coloring (with GraphData structure rework)". powerOf2Floor() will utilize __builtin_clz() or stdc_bit_floor_ui() (__builtin_clz() is preferred) if either is supported. popCount8() will utilize ARM NEON instructions and x86 POPCNT instruction if the machine supports either of them. I am not adopting the C23 standard interface stdc_count_ones_uc() yet, as I am not sure C libraries would implement it as fast as our version. Signed-off-by: Kang-Che Sung <[email protected]>
Rewrite the entire graph meter drawing code to support color graph drawing in addition to the dynamic scaling (both can work together because of the new GraphData structure design). The colors of a graph are based on the percentages of item values of the meter. The rounding differences of each terminal character are addressed through the different numbers of braille dots. Due to low resolution of the character terminal, the rasterized colors may not look nice, but better than nothing. :) The new GraphData structure design has two technical limitations: * The height of a graph meter now has a limit of 8191 (terminal rows). * If dynamic scaling is used, the "total" value or scale of a graph now has to align to a power of 2. The code is designed with the anticipation that the graph height may change at runtime. No UI or option has been implemented for that yet. Signed-off-by: Kang-Che Sung <[email protected]>
Specifically 'PIXPERROW_*' and 'GraphMeterMode_dots*' constants. They were commented out rather than removed in the previous commit (for ease of code reviewing). Now this commit removes the constant defines for good.
Introduce a new meter mode (meter style) called "Graph2". The "Graph2" name stands for "two-channel graph" or "two-quadrant graph". This meter mode is not in the list of default supported modes. This "Graph2" mode is intended for meters with two item values. It plots the first item above the x-axis and the second item below the x-axis. Items other than the first two are always hidden. This code is written with the intention to share as much code with the Graph meter mode as possible. Signed-off-by: Kang-Che Sung <[email protected]>
This special case of "details" value would print as ':' in the ASCII display mode. It is used in "Graph2" meter drawing only. Signed-off-by: Kang-Che Sung <[email protected]>
f910395 to
533fd24
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request implements the "two-channel" graph style as the new "Graph2" meter mode. This is based on #714 so that the graphs will be shown with colors.
This new mode is designed for a few meters only— only
DiskIORateMeter(#1763) andNetworkIOMetercan correctly utilise this mode by showing the input and output rates as separate channels.The feature was previously discussed in #1390.
Below is a preview screenshot taken in macOS Sequoia.

I included both Unicode mode and
--no-unicodemode.