Commit Graph

119 Commits

Author SHA1 Message Date
Christian Göttsche 68f2bfea61 Abstract resize handling by adding a new Htop reaction 2021-08-22 10:40:59 +02:00
Daniel Lange a0c244a163 Spell out virtualized 2021-08-18 14:01:25 +02:00
Nathan Scott d5ff5c48a8
Apply suggestions from code review
Co-authored-by: BenBE <BenBE@geshi.org>
2021-08-17 15:42:10 +10:00
Nathan Scott c401ac3a98 Ensure DynamicColumn hash lookups never see NULL pointers
This cannot happen in these code locations, but for the purposes
of static checkers like Coverity scan (and for future proofing),
add two more guards on NULL hash table entry pointers.
2021-08-17 14:41:40 +10:00
Christian Göttsche edafa26f9e Simplify Action_pickFromVector() width parameter usage
Pass one less instead of subtracting one inside the function.
2021-08-16 08:05:46 +02:00
Sohaib Mohamed 6f2021f3d9 PCP: support for 'dynamic columns' added at runtime
Implements support for arbitrary Performance Co-Pilot
metrics with per-process instance domains to form new
htop columns.  The column-to-metric mappings are setup
using configuration files which will be documented via
man pages as part of a follow-up commit.

We provide an initial set of column configurations so
as to provide new capabilities to pcp-htop: including
configs for containers, open fd counts, scheduler run
queue time, tcp/udp bytes/calls sent/recv, delay acct,
virtual machine guests, detailed virtual memory, swap.

Note there is a change to the configuration file path
resolution algorithm introduced for 'dynamic meters'.
First, look in any custom PCP_HTOP_DIR location.  Then
iterate, in priority order, users home directory, then
local sysadmins files in /etc/pcp/htop, then readonly
configuration files below /usr/share/pcp/htop.  This
final location becomes the preferred place for our own
shipped meter and column files.

The Settings file (htoprc) writing code is updated to
not using the numeric identifier for dynamic columns.
The same strategy used for dynamic meters is used here
where we write Dynamic(name) so the name can be setup
once more at start.  Regular (static) columns writing
to htoprc - i.e. numerically indexed - is unchanged.
2021-08-13 07:32:57 +02:00
Christian Göttsche 1fb0c720fe Enable affinity support for non-Linux
sched_getaffinity() and sched_setaffinity() are also available on BSDs.
Remove the Linux restraint.
2021-07-18 07:50:48 +02:00
Christian Göttsche 41af31be7f Rework CPU counting
Currently htop does not support offline CPUs and hot-swapping, e.g. via
    echo 0 > /sys/devices/system/cpu/cpu2/online

Split the current single cpuCount variable into activeCPUs and
existingCPUs.

Supersedes: #650
Related: #580
2021-07-18 07:44:02 +02:00
Benny Baumann 0d85af2872 Whitespace around operators 2021-07-15 06:57:24 +02:00
Benny Baumann e7f8d7bcc9 Split statements that should go onto multiple lines 2021-07-15 06:57:24 +02:00
Benny Baumann a75b99a15e Document '?' key to reach the help screen 2021-04-21 21:49:03 +02:00
Christian Göttsche 36880cd61c Add read-only option
Add command line option to disable all system and process changing
features.
2021-04-14 17:21:43 +02:00
David Zarzycki 3e8da0fcb6 Add MEMORY_SHARED to help screen 2021-03-24 19:30:28 +01:00
Christian Göttsche 16243a4a7e Action: merge conditions 2021-03-17 17:53:23 +01:00
Christian Göttsche a4173f5209 Improve process following
- stay in follow mode on sort inversion (I)
- stay in follow mode after viewing help screen (h)
- select parent process (where available) when having followed a thread
  and hiding these (H)

Closes: #560
2021-03-14 14:47:15 +01:00
Christian Göttsche 59a150e8d7 Follow followed process when switching thread visibilities
Do not stop following a process when switching the visibility of
userland or kernel threads.

Related: #557
2021-03-03 20:06:14 +01:00
Daniel Lange 525d37d6a4 Shorten keyboard help to fit default screen width 2021-02-16 09:12:07 +01:00
Daniel Lange 2c6222e30a Option and key ("*") to collapse / expand all branches under PID 1
(and PID 2 if kernel threads are shown)

Based on hishamhm/htop#510 by Krishna Chaitanya, B
Closes #68
2021-02-13 16:47:04 +01:00
Daniel Lange e86acd6893 Remove force sort order to ASC when returning to tree mode
Bug found by BenBE via IRC
2021-02-07 13:46:57 +01:00
Christian Göttsche fd4e6b432b Use MainPanel type in State struct
The State struct holds a pointer to the main process panel.
Use the distinct MainPanel type, to improve maintainability regrading
its usage.
This avoids usages of down-casts from Panel to MainPanel, only up-casts
from MainPanel to Panel are now required.
2021-02-05 14:12:49 +01:00
Christian Göttsche 211121f060 Drop invalid todo
The surrounding code has nothing to do with colors
2021-01-27 17:06:21 +01:00
David Zarzycki 37e186fd66 Linux: Add SwapCached to the swap meter
According to the Linux kernel documentation, "SwapCached" tracks "memory
that once was swapped out, is swapped back in but still also is
in the swapfile (if memory is needed it doesn't need to be swapped out
AGAIN because it is already in the swapfile. This saves I/O)."
2021-01-11 20:27:47 +01:00
Christian Göttsche d72b0a682e Mark several non-modified pointer variables const 2021-01-11 20:12:34 +01:00
Christian Göttsche 8fe04b7494 Hashtable: use more distinct typename for key type 2021-01-06 16:59:28 +01:00
Christian Göttsche ce9e7fd14f Panel_new: reorder arguments
Reorder owner and type so they match the order of Panel_init
2021-01-04 23:12:43 +01:00
Christian Göttsche a3cced9fb6 Add option to hide the Function Bar
Support three settings:
  - Always show Function Bar
  - Always hide the Function Bar, except in Infoscreens (Env/Locks...)
    and when editing the search and filter mode
  - Hide the Function Bar on ESC until the next user input

Closes: #439
2021-01-04 23:12:43 +01:00
Christian Göttsche eb6f8d569d Action: drop resize callback
The supervising ScreenManager will resize all Panels
2021-01-04 23:12:43 +01:00
Christian Göttsche f6aa5d29bb Action: remove trivial wrapper function 2021-01-01 21:31:30 +01:00
Jake Mannens f1463fdd64 Added keybind 'N' for sorting by PID 2020-12-23 18:30:26 +01:00
Jake Mannens 3edb6e1ea3 Position help labels one step to the right 2020-12-23 18:24:22 +01:00
Jake Mannens f46ddd3230 Remove 'n' and 'N' search inc/dec keybinds 2020-12-24 03:24:15 +11:00
Nathan Scott 737cd6167a Merge branch 'resize_bar' of https://github.com/cgzones/htop into cgzones-resize_bar 2020-12-22 15:25:08 +11:00
Daniel Lange 9b8b380c32 De-lazy @cgzones :) 2020-12-21 20:40:00 +01:00
Christian Göttsche a09ad6b8b4 Action: sort key binding assignments
Avoid accidental duplicate usage.
2020-12-21 15:53:42 +01:00
Christian Göttsche e3862aa67e Rework drawing of FunctionBar
Draw the FunctionBar within Panel_draw instead of manually throughout
the code.
Add an optional PanelClass function drawFunctionBar, to allow specific
panels to override the default FunctionBar_draw call.
Rework the code on color change, to really change all colors (selection
markers and panel headers).

Closes: #402
2020-12-20 17:01:50 +01:00
Hisham Muhammad 2327260ee8 Separate tree and list sort orders
Implements the suggestion from https://github.com/htop-dev/htop/issues/399#issuecomment-747861013

Thanks to the refactors from 0bd5c8fb5da and 6393baa74e5, this was really easy
and clean to do.

It maintains the "Tree view always by PID" option in the Settings, which
results in some specific behaviors such as "clicking on the column header to
exit tree view" and "picking a new sort order to exit tree view", for the sake
of the muscle memory of long time htop users. :)
2020-12-19 16:02:34 +01:00
Hisham Muhammad e8c6994f40 Add "Tree view is always sorted by PID" option to mimic htop 2 behavior 2020-12-19 16:02:34 +01:00
Benny Baumann 0401df8cbd Update key mapping documentation for sorting 2020-12-18 07:37:23 +01:00
Christian Göttsche db5687a355 Sort in paused mode after inverting sort order 2020-12-09 13:43:07 +01:00
Maxim Zhiburt cf306ff86e Implement sorting in tree mode 2020-12-02 23:50:05 +01:00
Christian Göttsche 19b5141685 Hide process selection on ESC
Do not highlight the current process line after pressing ESC in the main
screen.
Restore after pressing any key.
2020-11-28 19:49:38 +01:00
Nathan Scott fee217551c Drop unneeded parameters to the ScreenManager constructor
All calls to ScreenManager_new always pass the same first
five values, the orientation is always HORIZONTAL and the
y1 parameter is always the height of the passed-in header
struct pointer.  I think its safe to assert at this point
that no VERTICAL orientation will arrive (if it does, its
no harm in re-adding this then) - so we can remove unused
conditionals (and TODOs) based on orientation too.
2020-11-26 23:55:53 +01:00
Narendran Gopalakrishnan 09fe94da18 Improving Command display/sort 2020-11-24 19:05:48 +01:00
Christian Goettsche f5c3349bdb IWYU update (FreeBSD) 2020-11-19 23:51:50 +01:00
Christian Göttsche 7cf5277594 IWYU update (Linux) 2020-11-19 23:51:50 +01:00
Christian Göttsche 7914ec201e Hashtable update
- use consistent type for key by introducing a new typedef
- use unsigned types for sizes
- name parameters in foreach function typedef
2020-11-17 02:01:02 +01:00
Christian Göttsche ad72b747fa Drop hideThreads Setting
It is only used to read process directories on RedHat beginning with a dot.
Unconditionally accept directories with a starting dot.
2020-11-15 22:54:14 +01:00
Daniel Lange bb908f3dc4 Resolve merge conflicts, merge #298 "Macro cleanup" from @BenBE 2020-11-15 14:33:09 +01:00
Benny Baumann 18763051a2 Split platform dependent parts for file locks screen 2020-11-14 15:51:26 +01:00
Fynn Wulf 84dad4c38e Implement screen for active file locks 2020-11-09 19:17:57 +01:00