Commit Graph

2647 Commits

Author SHA1 Message Date
Sohaib Mohamed 93be3211ae PCP: use palette meter text colour for dynamic meter labels 2021-07-07 13:59:33 +10:00
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
Nathan Scott 865b85eb2d Fix an assert on kernel process name length on the PCP platform 2021-07-07 10:59:36 +10:00
Nathan Scott a0f758009b Fix bitmask used to extract CPU identifier for CPUMeter
When manipulating CPUMeters in the AvailableMeterPanel we
use the bottom 16 bits to hold the CPU number.  However,
the bitmask used to extract the CPU number only masks the
lower 8 bits (0xff).
2021-07-07 10:59:36 +10:00
Benny Baumann 44d1200ca4 Check for alloc_size attribute in configure.ac 2021-07-06 17:20:32 +02:00
Daniel Lange 3da142b4b6 Merge branch 'solaris-define-fixes' of BenBE/htop
Tested on OmniOS v11 r151036
2021-07-05 07:51:39 +02:00
Daniel Lange a60ff33e52 Merge branch 'check-set-escdelay' of BenBE/htop 2021-07-05 07:51:12 +02:00
Benny Baumann 364e4e692f Reduce visibility of GZONE and UZONE
Fixes #624
2021-07-04 19:34:03 +02:00
Benny Baumann 32414dace7 Remove unused define on Solaris 2021-07-04 19:32:47 +02:00
Benny Baumann 18e3fd5ce7 Check for set_escdelay in ncurses 2021-07-04 16:50:41 +02:00
Benny Baumann 874fb773a7 Fix typo in Generic_gettime_realtime on old Mac
Fixes #673
2021-07-01 23:27:54 +02:00
Sohaib Mohamed ecb6a8da78 PCP: Fix minor cut+paste typo 2021-06-30 07:45:47 +02:00
BenBE 3bed682b1e Always update `proc->st_uid` + `proc->user`
Avoids issue #661.
2021-06-26 12:18:37 +02:00
fraggerfox 686309e34c Redo the memory values based on the other BSD implementations. 2021-06-26 12:18:37 +02:00
fraggerfox 5fe9bcb21c Adds support for counting user and kernel threads. 2021-06-26 12:18:37 +02:00
fraggerfox 336acb0309 Adds support for PROC_EXE and CWD. 2021-06-26 12:18:37 +02:00
fraggerfox 612462e33d Adds the ELAPSED column for NetBSD.
Additional details regarding ELAPSED column can be found in #627.
2021-06-26 12:18:37 +02:00
fraggerfox 58a895e54c Fixes minor whitespace issues and re-arrange headers to conform to style guide. 2021-06-26 12:18:37 +02:00
fraggerfox 9de463e756 Implements the NetBSD specific changes for makeCommandStr refactor.
Refer to #388 PR for more details.
2021-06-26 12:18:37 +02:00
fraggerfox fa65c30976 Sets a non-NULL process state in case of kvm_getlwps(3) returns NULL. Thanks @cgzone. 2021-06-26 12:18:37 +02:00
fraggerfox 3770769ed1 Replaces WRAP_SUBTRACT with saturatingSub inline function to reduce code duplication. 2021-06-26 12:18:37 +02:00
fraggerfox 2f5b3ef733 Refactor saturatingSub() to be part of Macros.h 2021-06-26 12:18:37 +02:00
fraggerfox e42ae55d69 Renames variable from opl to npl for consistency. 2021-06-26 12:18:37 +02:00
fraggerfox 497f468ed0 Fix include paths and minor whitespace issues 2021-06-26 12:18:37 +02:00
fraggerfox 9b6cecfede Replace strlcpy() by safer String_safeStrncpy() 2021-06-26 12:18:37 +02:00
fraggerfox 3414d3b2d4 Replace maximum_PID value with INT32_MAX
Thank you @niacat.
2021-06-26 12:18:37 +02:00
fraggerfox 9e3b7c439c Update README for NetBSD 2021-06-26 12:18:37 +02:00
fraggerfox ddcfb179b4 Remove unwanted code, updates the comments 2021-06-26 12:18:37 +02:00
Benny Baumann b900e70e80 Update copyright notices 2021-06-26 12:18:37 +02:00
fraggerfox 440bb87058 Minor code clean up and corrections. 2021-06-26 12:18:37 +02:00
fraggerfox db98623684 Sync changes from master and fix minor warnings 2021-06-26 12:18:37 +02:00
fraggerfox 4b49de44a8 Add NetBSD platform support without procfs dependency
- TODO, clean up the code base and update comments in code.
2021-06-26 12:18:37 +02:00
Benny Baumann 30dc4a2812 Add a section on PRs for the styleguide 2021-06-26 11:11:13 +02:00
Benny Baumann 07170aee4c Unsupported: Remark on expectation of username field update 2021-06-22 09:32:11 +02:00
Benny Baumann 4dce2db832 Solaris: Always update username 2021-06-22 09:32:11 +02:00
Benny Baumann 1c0bd5155f PCP: Always update username 2021-06-22 09:32:11 +02:00
Benny Baumann d2a476cddb OpenBSD: Always update username 2021-06-22 09:32:11 +02:00
Benny Baumann 6a6b09b431 Darwin: Always update username 2021-06-22 09:32:11 +02:00
Daniel Lange 8aca6fbfbd Change 3.0.6-dev -> 3.1.0-dev 2021-06-18 07:52:44 +02:00
BenBE ad1ca7ee57
Update IRC channel (Part 2) 2021-06-16 14:57:49 +02:00
BenBE 78793c5584
Update IRC channel
The development channel on IRC moved to libera.chat
2021-06-16 14:54:20 +02:00
Benny Baumann 92324d3461 Minor whitespace issue in configure.ac 2021-06-13 19:51:00 +02:00
Nathan Scott e3d0fc1a5a Fix a PCP diagnostics typo, add missing pmFreeResult null check. 2021-06-13 19:51:00 +02:00
Nathan Scott 6f9b161b24 Use the PACKAGE macro rather than htop directly, for overriding
Allow other projects (PCP) to be able to ship an htop binary
which uses the custom name (pcp-htop) in several diagnostics
so that its clear which (if any!) binary failed.
2021-06-13 19:51:00 +02:00
Nathan Scott 0bd1025e94 Resolve a couple of recent memory leaks in pcp-htop
Makes the pcp-htop binary valgrind-clean once more.
2021-06-13 19:51:00 +02:00
Christian Göttsche df752dd189 Do not override Linux process library size
The library size in statm is unused and always 0 since Linux 2.6.

Fixes: 8154125d4b
2021-06-12 20:44:33 +02:00
Christian Göttsche 45ab05c56a Limit deleted library check
Reading and parsing /proc/<pid>/maps is quite expensive.

Do not check for deleted libraries if the main binary has been deleted;
in this case the deleted binary takes precedence.

Do not check in threads.  The check is void for kernel threads and user-
land threads can just inherit the state from the main process structure.
2021-06-12 16:02:23 +02:00
Benny Baumann 7a8a6dd828 Do not install recommended packages by default for the CI
This ensures, the minimal dependencies we specify are sufficient.
Also this reduces fallout from broken recommendations.
2021-06-12 15:27:52 +02:00
Benny Baumann de1d06300d Apply stale lib highlighting for EXE too 2021-06-11 09:04:23 +02:00
Christian Göttsche 9114cf6ea3 Linux: update process uid on change
Always check if the user of a process changed, e.g. by using setuid(2).
2021-06-09 22:52:18 +02:00