htop icon indicating copy to clipboard operation
htop copied to clipboard

Request for a setup option to hide offline CPUs in the CPUMeter

Open hyder365 opened this issue 2 years ago • 14 comments

Hi. Would it be possible to add a configure flag (or even runtime option) to disable the showing of offline CPUs? It's taking up space in the terminal for no reason that I can see. Thanks.

hyder365 avatar Oct 21 '21 20:10 hyder365

Do you refer to LXC/cgroups cpu limiting?

sergey-dryabzhinsky avatar May 20 '22 06:05 sergey-dryabzhinsky

No, this is about (for example) Intel CPUs with hyperthreading disabled. All the offline CPUs are still shown in htop, but wasting space in a small terminal.

hyder365 avatar May 20 '22 14:05 hyder365

@hyder365 Did you tried lates code from master? It already uses /sys/devices/system/cpu/cpu*/online lookups.

sergey-dryabzhinsky avatar May 20 '22 16:05 sergey-dryabzhinsky

Issue still present in 3.2.1.

hyder365 avatar Jun 04 '22 01:06 hyder365

Issue still present in 3.2.1.

Features and bug fixes included with a new release are usually listed as part of the change log, but normally also appear as part of the respective milestone. Have a look at https://github.com/htop-dev/htop/milestone/8 for the 3.2.1 release.

Currently this issue is not yet included with any upcoming milestone and given that this is a new feature there is no guaranteed schedule for it's implementation.

BenBE avatar Jun 04 '22 17:06 BenBE

I've built htop from git master as of today and still see the offline CPUs. g198kG6

hyder365 avatar Jun 11 '22 15:06 hyder365

@hyder365: you will see that until you develop a patch, create a pull request, get that accepted and finally merged (or somebody else thinks this is request is worth being implemented and does it)

fasterit avatar Jun 11 '22 17:06 fasterit

Ok. The comment by @sergey-dryabzhinsky led me to believe it was fixed in the master branch.

hyder365 avatar Jun 11 '22 17:06 hyder365

@hyder365: you will see that until you develop a patch, create a pull request, get that accepted and finally merged (or somebody else thinks this is request is worth being implemented and does it)

Screenshot 2023-06-21 at 11 47 09

I think it's worth doing also, fwiw. As will likely any other heavy user of LXC.

alchemydc avatar Jun 21 '23 17:06 alchemydc

I am impacted as well, having just upgraded to Debian Bookworm in an environment where virtual cores are disabled.

Screenshot 2023-10-14 at 16 25 51

LukeWheeldon avatar Oct 14 '23 20:10 LukeWheeldon

In case it can help anyone, there's a way around this issue.

First, you need to configure htop and remove all the CPU displayed by default, and re-add them one by one, half on the left, half on the right.

Then, you need to save the configuration so you don't have to repeat the operation (it takes a little while). On MacOS/iTerm I could do that with the keyboard combination "fn+F10", other systems likely have similar ways of saving the configuration to disk.

Screenshot 2023-10-19 at 20 33 49

edit 1: I see that I messed up slightly as I have added one too many cores; not a problem, I will quickly adjust using the aforementioned method. edit 2: Careful though, this method is not dynamic; if cores that were previously offline are back online, they won't show up automatically anymore.

LukeWheeldon avatar Oct 19 '23 18:10 LukeWheeldon

Unfortunate that such workarounds are needed for so basic a feature after two years.

moralground avatar Oct 19 '23 18:10 moralground

Unfortunate that such workarounds are needed for so basic a feature after two years.

As this is a new feature its usually not high on the list of priorities, unless people supply a patch with it. Also with any feature involving additional items of configuration we are usually quite reluctant, as this adds a maintenance cost going forward. And the last item is the automatic height adjustment required for this feature to be "dynamically" hiding the meters is a bit more involved than might be visible on first glance: You not only have to determine the number of visible meters dynamically (doable), calculate the needed height from this (doable), but also map each meter to its proper spot (non-trivial if truly dynamic).

If you want to speed up the inclusion of this feature a working patch is a good first step in that direction.

BenBE avatar Oct 20 '23 07:10 BenBE

Any update? People with HT disabled get all this wasted space in htop still.

hyder365 avatar Jan 12 '24 16:01 hyder365