Commit Graph

2293 Commits

Author SHA1 Message Date
Benny Baumann e341217fea Properly handle multiple batteries on darwin
This makes the behaviour consistent with other platforms where AC is
marked as present if at least one power source is marked as AC_PRESENT.

Fixes: #711
2021-08-02 14:37:44 +02:00
Benny Baumann 44e01dd32b Makefile.am fix that actually does a proper substitution 2021-08-02 00:43:10 +02:00
Benny Baumann 03705a20aa Fix portability issue in Makefile.am
Fixes #662
2021-08-02 00:00:46 +02:00
Nathan Scott 19ad28a560 PCP: fix per-process user and system time conversions 2021-07-29 10:15:43 +02:00
Nathan Scott 97d9b320ad PCP: use the correct metric for shared memory calculations 2021-07-29 10:14:51 +02:00
nia 4f3ba680fb Fix indentation style 2021-07-21 21:06:58 +02:00
nia 3fced48eea netbsd: convert snprintf use to xSnprintf 2021-07-21 21:06:58 +02:00
nia a4b650fdec netbsd: re-initialize freqSize before sysctlbyname() 2021-07-21 21:06:58 +02:00
nia 72cea2881c netbsd: Remove conditional compilation of CPU frequency variables 2021-07-21 21:06:58 +02:00
nia b4884373e5 netbsd: Support display of CPU frequency 2021-07-21 21:06:58 +02:00
Daniel Lange 370f89c086 Merge branch 'fix-dragon' of smalinux/htop 2021-07-18 13:03:13 +02:00
Sohaib Mohamed 32faba0b6d DragonFlyBSD: fixup: ProcessList_new declaration & definition mismatch 2021-07-18 12:41:11 +02:00
Sohaib Mohamed 82aa956940 PCP: fixup: missing setter for isUserlandThread
fixes the color of PROC_COMM for PCP...
2021-07-18 10:28:52 +02:00
Daniel Lange 2fe4a6351e Merge branch 'show-thread-names-fix' of BenBE/htop 2021-07-18 10:21:06 +02:00
Sohaib Mohamed 90b209ee37 PCP: fixup: Missing headers for DynamicMeter 2021-07-18 09:36:59 +02:00
Benny Baumann 7bfd62b8e4 Respect "Show custom thread names" setting 2021-07-17 20:59:50 +02:00
Nathan Scott c9abd788b1 Minor README wordsmithing on review of recent deps/build changes 2021-07-16 12:48:07 +10:00
Nathan Scott 0b787ca0b8 Merge branch 'README-update' of https://github.com/Eideen/htop into Eideen-README-update 2021-07-16 10:36:46 +10:00
nia e8f27ebc26 Disable mouse option when support is unavailable 2021-07-15 19:09:08 +02:00
nia 2ab8fb83ba netbsd: Support curses libraries without ncurses mouse support
This adds a configure check for the ncurses getmouse() function
and disables mouse-related code paths when mouse support is
not present in the curses library.

This is necessary for stable versions of NetBSD's libcurses, the
development version has stub mouse functions for compatibility
with ncurses.

Signed-off-by: Nia Alarie <nia@NetBSD.org>
2021-07-15 19:09:08 +02:00
Scott Olson d45b4f4a43 Use PATH lookup for systemctl in systemd meter
Before this change, the systemd meter was broken on distros like NixOS,
which have systemctl in PATH, but not at /bin/systemctl. After the
change, it works on all my NixOS machines.
2021-07-15 10:21:12 +02:00
Benny Baumann df435931b6 Proper label indentation 2021-07-15 06:57:24 +02:00
Benny Baumann 279140db21 Align descriptive comments 2021-07-15 06:57:24 +02:00
Benny Baumann 976c6123f4 Pointer indication aligned to typename 2021-07-15 06:57:24 +02:00
Benny Baumann 68edf92434 Indentation of string arguments 2021-07-15 06:57:24 +02:00
Benny Baumann 0d85af2872 Whitespace around operators 2021-07-15 06:57:24 +02:00
Benny Baumann 458749df45 Code indentation 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
nia 3bc73aa088
netbsd: update README.md (#694)
netbsd: update README.md
2021-07-15 06:41:42 +02:00
Nathan Scott f21f81b2de
Merge pull request #695 from smalinux/zfs-orgniz
PCP: cleanup: put ZFS in its rightful place
2021-07-15 12:11:09 +10:00
Sohaib Mohamed 3853978538 PCP: cleanup: put ZFS in its rightful place
`PCPProcessList_updateHeader` for all meters...
2021-07-15 03:47:54 +02:00
Nathan Scott 2b69f44a9d Fix whitespace oddity in previous DynamicMeter updates
Thanks @BenBE for noticing.
2021-07-14 17:08:36 +10:00
Nathan Scott 0daefbe4b4 Improve the DynamicMeter_search API to make 'key' optional
Thanks to @BenBE for the suggestion.
2021-07-14 11:58:46 +10:00
Nathan Scott 9cbee01877 Additional pointer checks in dynamic meter code for Coverity 2021-07-14 11:58:46 +10:00
Nathan Scott bf853addc3 Ensure PCP dynamic metric configuration definition uniqueness
It can happen that pcp-htop is presented multiple definitions
of the same dynamic meter, e.g. if /etc/pcp/htop/meters has a
definition matching one in ~/.config/htop/meters - instead of
exiting with a duplicate metric error provide more meaningful
diagnostics (on close) and also just skip over such entries.
System files override home directories which overrides those
found below the current working directory.

Also fix the derived metric error diagnostic; because this is
using CRT_fatalError, which is like perror(3), we must give a
meaningful prefix (like program name) at the string end.
2021-07-14 11:58:46 +10:00
Nathan Scott a476490282 Ensure we do not attempt to add a DynamicMeter via the
htoprc that we didn't find during start up.  This just
leaves blank sections of the display as @smalinux found.

Related to https://github.com/htop-dev/htop/pull/682
2021-07-14 11:58:31 +10:00
Benny Baumann bf22a8fb13 Add SIGINT handler
This SIGINT handler is installed on top of an optional
handler that some curses/ncurses implementations provide.

This ensures the curser is properly reset when hitting Ctrl+C.
2021-07-13 20:42:30 +02:00
nia 09c7e3e136 netbsd: Support building with libcurses
Right now Unicode support must be disabled, because htop peeks
into the ncurses cchar_t struct with Unicode enabled. NetBSD's cchar_t
has different contents.

Partially fixes #660

Signed-off-by: Nia Alarie <nia@NetBSD.org>
2021-07-13 20:42:30 +02:00
nia 4865e643ad netbsd: Fix display of in-use and cached memory 2021-07-13 19:06:30 +02:00
nia 67ca214cbe netbsd: Add dyanmicMeters stubs to fix the build
Signed-off-by: Nia Alarie <nia@NetBSD.org>
2021-07-13 19:05:24 +02:00
Eideen 9bba1c6cf7 README updates/formating
Formating add section "prerequisite"
To make it easy to build
Merged  Compiling from source and Github tarball ref: #639
removed tarball downloads #680
2021-07-11 14:10:47 +02:00
Nathan Scott e7aaf79166 Remove unnecessary include files from PCPDynamicMeter.c
Also resolve a few unintended style guide transgressions
in the PCP platform code.
2021-07-09 12:42:36 +10:00
Nathan Scott 9f667f2c74 Remove references to bintray in the README, no longer exists 2021-07-08 16:34:27 +10:00
Nathan Scott 01f5b89278 Pretty-print values in the PCP DynamicMeter code
Several improvements to the way values are displayed in the
PCP platform DynamicMeter implementation:
- handle the initial 'caption' setting as with regular meters,
  this required a new meter callback because we no longer have
  just a single meter caption for the DynamicMeter case
- if no label is provided for a metric in a configuration file
  use the short form metric name as a fallback
- honour the suffix setting in the configuration file
- convert metric values to the canonical units for htop (kbyte
  and seconds), and use Meter_humanUnit when it makes sense to
  do so.

Also improves the handling of fatal string error messages in a
couple of places, thanks to BenBE for the review feedback.
2021-07-08 10:56:05 +10:00
Nathan Scott 149774209b Remove Linux-specific cpp conditional in SwapMeter.c
Instead use the common NAN pattern to use of the swap
cached value on platforms that do not support it.
2021-07-07 14:24:32 +10:00
Nathan Scott 15a71f32fe Add more defensive checks to PCP paths if sampling fails 2021-07-07 14:00:36 +10:00
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