htop icon indicating copy to clipboard operation
htop copied to clipboard

Filter on process state

Open OlafvdSpek opened this issue 1 year ago • 8 comments

Is it possible to filter on process state (state == 'D' for example)? If not, it'd be nice. And is there a meter that'll show the number of processes in each state?

OlafvdSpek avatar Oct 03 '24 07:10 OlafvdSpek

The answer to both of your questions is currently: No.

This feature does not currently exist and the necessary information to make it a meter is not currently counted while gathering information.

BenBE avatar Oct 03 '24 15:10 BenBE

This looks like something I can take a look at for hacktoberfest. I'll fork, clone and build (to get started) unless someone objects.

Pointers to "the necessary information" and how to add to what is counted would probably get me off the ground a little quicker.

Thanks!

Step 0: look for contributor guidelines.

HankB avatar Oct 03 '24 16:10 HankB

Step 0: Read this document

Step 0.5: https://github.com/htop-dev/htop/blob/9c316cc14cafce1097583247710b6d74c1feb505/Process.h#L38-L56 and https://github.com/htop-dev/htop/blob/9c316cc14cafce1097583247710b6d74c1feb505/Process.h#L192

BenBE avatar Oct 03 '24 20:10 BenBE

I have not had the time to get to this so I won't be able to complete this work.

HankB avatar Oct 26 '24 13:10 HankB

I’ll start working on this.

melrovieira avatar Jun 24 '25 17:06 melrovieira

@BenBE just to remind you, this issue also involves a meter showing the number of processes in each state, not just the process state filter.

melrovieira avatar Aug 15 '25 18:08 melrovieira

If you like you can do a second PR for this to create this meter. Be sure to keep changes minimal and streamlined. Counting the number of processes/threads in each state is at most 2 lines when enumerating, one array for the counters (two if split between processes/threads) and a minimal meter to display the results.

Please use a branch distinct from main (that was part of the reason for the fumble yesterday).

BenBE avatar Aug 15 '25 19:08 BenBE

If you like you can do a second PR for this to create this meter. Be sure to keep changes minimal and streamlined. Counting the number of processes/threads in each state is at most 2 lines when enumerating, one array for the counters (two if split between processes/threads) and a minimal meter to display the results.

Please use a branch distinct from main (that was part of the reason for the fumble yesterday).

I will do it.

Só agora me toquei que o senhor também é brasileiro, prazer.

melrovieira avatar Aug 15 '25 23:08 melrovieira