Htop: Suggestion: Display only average CPU graph instead of showing all CPU on many cores machine

Created on 24 Jan 2017  Â·  9Comments  Â·  Source: hishamhm/htop

This is a usability issues rather than a bug. In the case of many cores machine with the default configuration, the entire terminal real estate is taken by large amount of CPU graph as shown in the picture below. Setup screen is also inaccessible since it is located below the CPU graph. I have to copy the htoprc from other machine to change the layout.

htop

This is a 512 threads IBM Power machine. Larger SMP machines are common today so this usability problem should be considered. We have another machine that has 4096 threads and would like to continue using htop.

Feature request: Please consider detecting the number of CPU cores automatically and select a proper layout to maintain usability.

Most helpful comment

I feel this issue is becoming more important as 64+ threads machines are quite mainstream in 2019 and htop is a reference tool for real-time monitoring.

Some suggestions/ideas to address the "too many CPU meters" issue while showing more than just a single average CPU meter:

  • CPU meters could show the average for groups of 2 or more threads.
  • This would enable changing the number of CPU meters as a function of screen height.
  • Dynamic grouping of CPU meters could be used to avoid filling up more than a predefined proportion of screen height (e.g. ~1/3).

All 9 comments

As a workaround, you can enable CPU Average editing ~/.config/htop/htoprc. Set these values instead of the ones currently in the file:

left_meters=CPU Memory Swap 
left_meter_modes=1 1 1 
right_meters=Tasks LoadAverage Uptime Battery 
right_meter_modes=2 2 2 2 

Thank you. I am aware of that. Basically editing the htoprc is what I did to fix the issue. I edited the setting on other machine then I copied the htoprc to the many cores machine.

But my request is, can you do it automatically, like when the number of the rows in the terminal is way less than the number of CPU core/4 than htop will automatically switch to CPU average instead of displaying all CPU? Or probably make the Header also scroll-able?

This small change will be good for me. This change will make htop usable since the first installation (no htoprc) on many cores machine.

Htop will now default to show only the CPU average if you have more than 64 CPUs. I guess people would not want to have more than 16 lines (64 cpu/4 col) of their terminal taken just for CPU bars.

--- Settings.c.old      2017-01-25 13:57:16.684393295 +0900
+++ Settings.c  2017-01-25 13:53:21.634249297 +0900
@@ -106,7 +106,7 @@

 static void Settings_defaultMeters(Settings* this) {
    int sizes[] = { 3, 3 };
-   if (this->cpuCount > 4) {
+   if (this->cpuCount > 4 && this->cpuCount <= 64) {
       sizes[1]++;
    }
    for (int i = 0; i < 2; i++) {
@@ -116,7 +116,10 @@
    }

    int r = 0;
-   if (this->cpuCount > 8) {
+   if (this->cpuCount > 64) {
+      this->columns[0].names[0] = xStrdup("CPU");
+      this->columns[0].modes[0] = BAR_METERMODE;
+   } else if (this->cpuCount > 8) {
       this->columns[0].names[0] = xStrdup("LeftCPUs2");
       this->columns[0].modes[0] = BAR_METERMODE;
       this->columns[1].names[r] = xStrdup("RightCPUs2");

I would consider issue #562 being a duplicate of this one.

Htop will now default to show only the CPU average if you have more than 64 CPUs. I guess people would not want to have more than 16 lines (64 cpu/4 col) of their terminal taken just for CPU bars.

You'd be surprised by how many people happily post htop screenshots with more than 64 CPUs.

I'll add my +1 for this. I've been working on Knights Landing boxes and, yeah, htop is fun on those. (I'm thinking #562 might be a KNL machine; that screen looks familiar.)

When the 4-column display is hidden, it'd be great to show the number of CPUs somewhere. Maybe a new meter or adding it to the CPU average meter.

âž•:one:

I feel this issue is becoming more important as 64+ threads machines are quite mainstream in 2019 and htop is a reference tool for real-time monitoring.

Some suggestions/ideas to address the "too many CPU meters" issue while showing more than just a single average CPU meter:

  • CPU meters could show the average for groups of 2 or more threads.
  • This would enable changing the number of CPU meters as a function of screen height.
  • Dynamic grouping of CPU meters could be used to avoid filling up more than a predefined proportion of screen height (e.g. ~1/3).
Was this page helpful?
0 / 5 - 0 ratings

Related issues

BenBE picture BenBE  Â·  5Comments

sbibauw picture sbibauw  Â·  7Comments

edouard-lopez picture edouard-lopez  Â·  3Comments

kaefer picture kaefer  Â·  4Comments

rafis picture rafis  Â·  7Comments