htop - an interactive process viewer
Go to file
Nathan Scott f0ed0fdafb Add a new DynamicMeter class for runtime Meter extension
This commit is based on exploratory work by Sohaib Mohamed.
The end goal is two-fold - to support addition of Meters we
build via configuration files for both the PCP platform and
for scripts ( https://github.com/htop-dev/htop/issues/526 )

Here, we focus on generic code and the PCP support.  A new
class DynamicMeter is introduced - it uses the special case
'param' field handling that previously was used only by the
CPUMeter, such that every runtime-configured Meter is given
a unique identifier.  Unlike with the CPUMeter this is used
internally only.  When reading/writing to htoprc instead of
CPU(N) - where N is an integer param (CPU number) - we use
the string name for each meter.  For example, if we have a
configuration for a DynamicMeter for some Redis metrics, we
might read and write "Dynamic(redis)".  This identifier is
subsequently matched (back) up to the configuration file so
we're able to re-create arbitrary user configurations.

The PCP platform configuration file format is fairly simple.
We expand configs from several directories, including the
users homedir alongside htoprc (below htop/meters/) and also
/etc/pcp/htop/meters.  The format will be described via a
new pcp-htop(5) man page, but its basically ini-style and
each Meter has one or more metric expressions associated, as
well as specifications for labels, color and so on via a dot
separated notation for individual metrics within the Meter.

A few initial sample configuration files are provided below
./pcp/meters that give the general idea.  The PCP "derived"
metric specification - see pmRegisterDerived(3) - is used
as the syntax for specifying metrics in PCP DynamicMeters.
2021-07-07 10:59:36 +10:00
.github Do not install recommended packages by default for the CI 2021-06-12 15:27:52 +02:00
darwin Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
docs Add a section on PRs for the styleguide 2021-06-26 11:11:13 +02:00
dragonflybsd Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
freebsd Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
generic Fix typo in Generic_gettime_realtime on old Mac 2021-07-01 23:27:54 +02:00
iwyu Add sys/dirent.h to iwyu/htop.imp 2020-12-11 20:57:19 +01:00
linux Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
netbsd Always update `proc->st_uid` + `proc->user` 2021-06-26 12:18:37 +02:00
openbsd Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
pcp Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
scripts Track file descriptors in valgrind script 2020-11-25 22:09:39 +01:00
solaris Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
unsupported Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
zfs platform-dependent files included relative to main source directory 2021-05-10 18:40:53 +02:00
.editorconfig Add `trim_trailing_whitespace` to editorconfig 2019-10-31 11:39:57 -05:00
.gitignore Implement command line and environment handling for pcp htop. 2021-06-09 17:09:29 +10:00
.travis.yml travis CI: drop macOS and Linux builds 2020-12-08 16:07:45 +01:00
AUTHORS Update AUTHORS file with htop-dev team 2020-12-05 11:07:32 +01:00
Action.c Document '?' key to reach the help screen 2021-04-21 21:49:03 +02:00
Action.h Use MainPanel type in State struct 2021-02-05 14:12:49 +01:00
Affinity.c Use `#if defined()` syntax when `#elif defined()` is present 2021-03-21 21:49:04 +01:00
Affinity.h Use unsigned types for CPU counts and associated variables 2021-03-19 23:30:54 +01:00
AffinityPanel.c Use unsigned types for CPU counts and associated variables 2021-03-19 23:30:54 +01:00
AffinityPanel.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
AvailableColumnsPanel.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
AvailableColumnsPanel.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
AvailableMetersPanel.c Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
AvailableMetersPanel.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
BatteryMeter.c Save text buffer in Meter 2021-03-04 23:57:45 +01:00
BatteryMeter.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
CONTRIBUTING.md Adjust to current label reality and the fact that Github can't search for multiple labels ORed ... yet. 2021-05-14 11:29:29 +02:00
COPYING Remove trailing whitespaces 2020-08-21 10:37:33 +02:00
CPUMeter.c Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
CPUMeter.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
CRT.c Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
CRT.h Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
CategoriesPanel.c Allow to pass '/' for item search 2020-12-03 22:41:31 +01:00
CategoriesPanel.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
ChangeLog Change 3.0.6-dev -> 3.1.0-dev 2021-06-18 07:52:44 +02:00
ClockMeter.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
ClockMeter.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
ColorsPanel.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
ColorsPanel.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
ColumnsPanel.c Mark several non-modified pointer variables const 2021-01-11 20:12:34 +01:00
ColumnsPanel.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
CommandLine.c Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
CommandLine.h Abstract htop main function to allow for a platform binary 2021-03-25 15:56:15 +11:00
CommandScreen.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
CommandScreen.h Make all required includes explicit 2020-10-18 20:09:05 +02:00
Compat.c DragonFlyBSD: resolve sign comparison 2021-04-14 17:29:56 +02:00
Compat.h Request the realtime and monotonic clock times once per sample 2021-04-05 23:41:07 +02:00
DateMeter.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
DateMeter.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
DateTimeMeter.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
DateTimeMeter.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
DiskIOMeter.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
DiskIOMeter.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
DisplayOptionsPanel.c Allow for highlighting of deleted executables to be configured 2021-05-23 09:30:36 +02:00
DisplayOptionsPanel.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
DynamicMeter.c Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
DynamicMeter.h Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
EnvScreen.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
EnvScreen.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
FunctionBar.c Rework drawing of FunctionBar 2020-12-20 17:01:50 +01:00
FunctionBar.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
Hashtable.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
Hashtable.h Hashtable: widen size from int to size_t 2021-01-06 16:59:28 +01:00
Header.c Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
Header.h platform-dependent files included relative to main source directory 2021-05-10 18:40:53 +02:00
HostnameMeter.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
HostnameMeter.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
IncSet.c Mark several non-modified pointer variables const 2021-01-11 20:12:34 +01:00
IncSet.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
InfoScreen.c Check for set_escdelay in ncurses 2021-07-04 16:50:41 +02:00
InfoScreen.h InfoScreen: drop unused member 2020-12-21 22:34:50 +01:00
ListItem.c RichString: do not unnecessarily clean whole buffer 2021-03-17 15:54:17 +01:00
ListItem.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
LoadAverageMeter.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
LoadAverageMeter.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
Macros.h Check for alloc_size attribute in configure.ac 2021-07-06 17:20:32 +02:00
MainPanel.c Make MainPanel_pidSearch a static function 2021-04-21 20:58:28 +02:00
MainPanel.h Make MainPanel_pidSearch a static function 2021-04-21 20:58:28 +02:00
Makefile.am Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
MemoryMeter.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
MemoryMeter.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
Meter.c Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
Meter.h Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
MetersPanel.c Mark several non-modified pointer variables const 2021-01-11 23:47:00 +01:00
MetersPanel.h Make all required includes explicit 2020-10-18 20:09:05 +02:00
NEWS Remove trailing whitespaces 2020-08-21 10:37:33 +02:00
NetworkIOMeter.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
NetworkIOMeter.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
Object.c Allow meters in text mode to span empty neighbors to the right 2021-01-23 15:20:47 +01:00
Object.h Object: always include stdbool.h 2021-03-12 16:38:36 +01:00
OpenFilesScreen.c Make Infoscreens the correct height 2021-01-11 12:53:07 +01:00
OpenFilesScreen.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
OptionItem.c Use RichString_appendnAscii where possible 2021-04-26 17:51:45 +02:00
OptionItem.h Add support to change numeric options in settings screen 2020-11-25 20:46:27 +01:00
Panel.c RichString: do not unnecessarily clean whole buffer 2021-03-17 15:54:17 +01:00
Panel.h Mark several non-modified pointer variables const 2021-01-11 20:12:34 +01:00
Process.c Apply stale lib highlighting for EXE too 2021-06-11 09:04:23 +02:00
Process.h Check processes for using deleted shared libraries 2021-06-09 14:40:04 +02:00
ProcessList.c Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
ProcessList.h Add a new DynamicMeter class for runtime Meter extension 2021-07-07 10:59:36 +10:00
ProcessLocksScreen.c Make Infoscreens the correct height 2021-01-11 12:53:07 +01:00
ProcessLocksScreen.h IWYU update (Linux) 2020-11-19 23:51:50 +01:00
ProvideCurses.h Use consistent style for include check 2021-03-19 22:39:06 +01:00
README Update IRC channel (Part 2) 2021-06-16 14:57:49 +02:00
README.md Add README.md for Github 2014-02-03 09:11:39 -02:00
RichString.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
RichString.h Enclose macro argument 2021-05-10 17:48:05 +02:00
ScreenManager.c Check for set_escdelay in ncurses 2021-07-04 16:50:41 +02:00
ScreenManager.h Mark several non-modified pointer variables const 2021-01-11 20:12:34 +01:00
Settings.c Allow for highlighting of deleted executables to be configured 2021-05-23 09:30:36 +02:00
Settings.h Allow for highlighting of deleted executables to be configured 2021-05-23 09:30:36 +02:00
SignalsPanel.c Panel_new: reorder arguments 2021-01-04 23:12:43 +01:00
SignalsPanel.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
SwapMeter.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
SwapMeter.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
SysArchMeter.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
SysArchMeter.h [#480] SysArchMeter to view kernel/arch info 2021-01-31 20:08:09 +01:00
TESTPLAN Small update to test plan 2021-02-13 14:04:15 +01:00
TasksMeter.c Use RichString_appendnAscii where possible 2021-04-26 17:51:45 +02:00
TasksMeter.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
TraceScreen.c cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
TraceScreen.h Mark several non-modified pointer variables const 2021-01-11 20:12:34 +01:00
UptimeMeter.c Save text buffer in Meter 2021-03-04 23:57:45 +01:00
UptimeMeter.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
UsersTable.c Hashtable: use dynamic growth and use primes as size 2020-11-17 02:01:02 +01:00
UsersTable.h cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
Vector.c Avoid calling Object_isA from inside Vector_isConsistent 2020-11-17 08:06:02 +01:00
Vector.h InfoScreen/ProcessList: do not access Vector internals 2021-03-12 16:46:55 +01:00
XUtils.c Mark several non-modified pointer variables const 2021-01-11 20:12:34 +01:00
XUtils.h Add compiler hints on memory allocating utility functions 2021-01-11 21:08:58 +01:00
autogen.sh autotools: enable warnings and cleanup 2020-09-17 21:45:11 +02:00
configure.ac Check for alloc_size attribute in configure.ac 2021-07-06 17:20:32 +02:00
htop.1.in htop.1.in: Some grammatical errors are fixed. 2021-05-30 11:15:45 +02:00
htop.c Abstract htop main function to allow for a platform binary 2021-03-25 15:56:15 +11:00
htop.desktop Add danish translation to htop.desktop 2019-02-19 01:25:52 +01:00
htop.png Update htop logo, provide .svg file as well 2020-12-05 13:46:34 +01:00
htop.svg Update htop logo, provide .svg file as well 2020-12-05 13:46:34 +01:00
pcp-htop.c Resolve some Coverity scan misfires in PCP platform code 2021-06-09 17:09:29 +10:00
test_spec.lua Remove trailing whitespaces 2020-08-21 10:37:33 +02:00

README.md

htop

CI Coverity Scan Build Status Mailing List IRC #htop Github Release Download

Screenshot of htop

Introduction

htop is a cross-platform interactive process viewer.

htop allows scrolling the list of processes vertically and horizontally to see their full command lines and related information like memory and CPU consumption.

The information displayed is configurable through a graphical setup and can be sorted and filtered interactively.

Tasks related to processes (e.g. killing and renicing) can be done without entering their PIDs.

Running htop requires ncurses libraries (typically named libncursesw*).

For more information and details on how to contribute to htop visit htop.dev.

Build instructions

This program is distributed as a standard GNU autotools-based package.

Compiling htop requires the header files for ncurses (libncursesw*-dev). Install these and other required packages for C development from your package manager.

Then, when compiling from a release tarball, run:

./configure && make

Alternatively, for compiling sources downloaded from the Git repository (git clone or downloads from Github releases), install the header files for ncurses (libncursesw*-dev) and other required development packages from your distribution's package manager. Then run:

./autogen.sh && ./configure && make

By default make install will install into /usr/local, for changing the path use ./configure --prefix=/some/path.

Build Options

htop has several build-time options to enable/disable additional features.

Generic

  • --enable-unicode: enable Unicode support dependency: libncursesw default: yes
  • --enable-hwloc: enable hwloc support for CPU affinity; disables Linux affinity dependency: libhwloc default: no
  • --enable-static: build a static htop binary; hwloc and delay accounting are not supported default: no
  • --enable-debug: Enable asserts and internal sanity checks; implies a performance penalty default: no

Linux

  • --enable-sensors: enable libsensors(3) support for reading temperature data dependencies: libsensors-dev(build-time), at runtime libsensors is loaded via dlopen(3) if available default: check
  • --enable-capabilities: enable Linux capabilities support dependency: libcap default: check
  • --with-proc: location of a Linux-compatible proc filesystem default: /proc
  • --enable-openvz: enable OpenVZ support default: no
  • --enable-vserver: enable VServer support default: no
  • --enable-ancient-vserver: enable ancient VServer support (implies --enable-vserver) default: no
  • --enable-linux-affinity: enable Linux sched_setaffinity(2) and sched_getaffinity(2) for affinity support; conflicts with hwloc default: check
  • --enable-delayacct: enable Linux delay accounting support dependencies: pkg-config(build-time), libnl-3 and libnl-genl-3 default: check

Usage

See the manual page (man htop) or the on-line help ('F1' or 'h' inside htop) for a list of supported key commands.

Support

If you have trouble running htop please consult your Operating System / Linux distribution documentation for getting support and filing bugs.

Bugs, development feedback

We have a development mailing list. Feel free to subscribe for release announcements or asking questions on the development of htop.

You can also join our IRC channel #htop on Libera.Chat and talk to the developers there.

If you have found an issue with the source of htop, please check whether this has already been reported in our Github issue tracker. If not, please file a new issue describing the problem you have found, the location in the source code you are referring to and a possible fix.

History

htop was invented, developed and maintained by Hisham Muhammad from 2004 to 2019. His legacy repository has been archived to preserve the history.

In 2020 a team took over the development amicably and continues to maintain htop collaboratively.

License

GNU General Public License, version 2 (GPL-2.0)