Commit Graph

2682 Commits

Author SHA1 Message Date
Nathan Scott 5b5836a2b1
Apply suggestions from code review
Co-authored-by: BenBE <BenBE@geshi.org>
2021-08-13 16:04:25 +10:00
Nathan Scott f839095e3b Merge branch 'dynamic-columns' of https://github.com/smalinux/htop into smalinux-dynamic-columns 2021-08-13 15:56:01 +10: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 6974ce8e79 Linux: do not include zram devices in DiskIO
The meter is intended to show *real* IO, which is significantly slower
than zram.
2021-08-10 22:01:42 +02:00
Christian Göttsche 796bc36fe0 Add assert to improve backtraces on NULL function pointer 2021-08-10 21:26:50 +02:00
Christian Göttsche ba5ef1ac8b CPUMeter: show if a CPU is offline in text mode
Related to #729 as the text mode displays all zero values for offline
CPUs.
2021-08-10 17:09:04 +02:00
Christian Göttsche 671282d309 Correct grammatical error in crash information
Spotted by @natoscott
2021-08-10 17:09:04 +02:00
Christian Göttsche a8b8f5f836 ScreenManager: drop unused member 2021-08-10 17:09:04 +02:00
Christian Göttsche 51669ecba8 Solaris: the average CPU utilization value must never be marked 'offline'
Similar to #729 only for Solaris
2021-08-10 17:09:04 +02:00
Nathan Scott 02cfd38671 The average CPU utilization value must never be marked 'offline'
Fixes https://github.com/htop-dev/htop/issues/729
2021-08-10 08:00:35 +02:00
nia 6d3b4a0f2e netbsd: handle repeated ENOMEM from HW_IOSTATS safely 2021-08-09 14:17:06 +02:00
Nathan Scott c31fd3c691 Merge branch 'pcp-dynamic-cpu' 2021-08-09 19:24:29 +10:00
nia 324f9d048d netbsd: add more robust error handling for sysctl HW_IOSTATS 2021-08-09 09:08:37 +02:00
nia 5b8654d341 netbsd: Add support for DiskIOMeter 2021-08-09 09:08:37 +02:00
Daniel Lange eb4ff3c69c Add Shift-F7, Shift-F8 keybindings for autogroups 2021-08-09 16:23:09 +10:00
Nathan Scott 1bd95983b2 Add columns for process autogroup identifier and nice value
Adds AGRP (autogroup) and ANI (autogroup nice) columns that
report the information from /proc/PID/autogroup, as well as
handlers for '{' and '}' to change the autogroup nice value.

This is guarded by /proc/sys/kernel/sched_autogroup_enabled
such that sampling and/or changing values wont be attempted
unless the kernel feature is enabled.

Fixes: #720
2021-08-09 07:56:13 +02:00
Nathan Scott ee831263c3 PCP: implement a missing piece for offline and hotplug CPUs
Related: #656
2021-08-09 12:42:45 +10:00
Christian Göttsche aa0424ade8 configure: check for NaN compiler support
Compilers might due to optimizations, like -ffast-math (included in
-Ofast) expect floating point variables to be never NaN and replace each
call to isnan() with false.  Htop uses the value NaN for signaling no
data available for various information.

Warn at configure time if the compiler will ignore NaN values.

Note: this can not be implemented as a compile time static assert, as
some compilers handle compile NaNs differently than runtime NaNs.
2021-08-08 17:02:12 +02:00
Christian Göttsche 10e9ffd8e5 Fix misc typos
[ci skip]
2021-08-08 15:10:58 +02:00
nia 97a859c5bd netbsd: Use newer proplib API. Create aliases so it works on 9.x.
This way we avoid deprecation warnings on the development branch
of NetBSD while keeping the code functioning on the stable branch.
2021-08-05 10:47:14 +02:00
nia c85aafa608 netbsd: If at least one AC adapter is connected, keep its state. 2021-08-05 10:47:14 +02:00
nia 93ca5af953 netbsd: style: declare variables on first use rather than C89-style 2021-08-05 10:47:14 +02:00
nia fdcdc54ec4 netbsd: Add battery support
This uses proplib and sysmon_envsys to determine the total charge
percentage of any number of connected batteries as well as the
AC adapter state. Should work with ACPI and non-ACPI systems.
2021-08-05 10:47:14 +02:00
fraggerfox 2e3f34f5c1 NetBSD: Rework CPU counting. 2021-08-05 10:25:59 +02:00
Nathan Scott 04da92dfd1 docs: updates and new manual page for pcp-htop
Add some words about pcp-htop to the main man page, and add a
new man page describing the pcp-htop configuration files that
allow new meters and columns to be defined at runtime.
2021-08-03 14:11:21 +10:00
Bart Bakker c1c4b5a1ab
Read settings after applying defaults
Default settings are used as a base and only settings specified in `htoprc` are
applied on top of it. This patch removes the special case for applying some
defaults  when the config does not contain a `meters` key. All defauls are set
before any attempt to read settings, so only keys actually present in the config
file are overridden.
2021-08-02 17:33:34 +02:00
Daniel Lange ed82ce6456 Merge branch 'cpu_count' of cgzones/htop 2021-08-02 15:21:07 +02:00
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
Christian Göttsche edf236f9fc OpenBSD: support offline CPUs and hot-swapping 2021-07-18 07:58:50 +02:00
Christian Göttsche f608fc5c8a OpenBSD: fix compile errors
openbsd/OpenBSDProcessList.c:176:56: error: no member named 'ki_pid' in 'struct kinfo_proc'; did you mean 'p_pid'?
   const int mib[] = { CTL_KERN, KERN_PROC_CWD, kproc->ki_pid };
                                                       ^~~~~~
                                                       p_pid
/usr/include/sys/sysctl.h:375:10: note: 'p_pid' declared here
        int32_t p_pid;                  /* PID_T: Process identifier. */
                ^
openbsd/OpenBSDProcessList.c:458:33: error: comparison of integers of different signs: 'int' and 'unsigned int' [-Werror,-Wsign-compare]
      if (opl->cpus[i].cpuIndex == id)
          ~~~~~~~~~~~~~~~~~~~~~ ^  ~~
2021-07-18 07:53:03 +02:00
Christian Göttsche 90cc16efc0 Solaris: support offline CPUs and hot-swapping
Example hot-swapping:
    psradm -F -f 2
2021-07-18 07:53:01 +02:00
Christian Göttsche f47e88f5e8 DragonFlyBSD: calculate whether to show entry last
Wait until it has been decided what kind of task the entry actually is.
2021-07-18 07:50:50 +02:00
Christian Göttsche b148a4bed2 DragonFlyBSD: drop void TODO 2021-07-18 07:50:50 +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 adcedf87f5 FreeBSD: mark the original kernel thread with pid 0 as such 2021-07-18 07:47:16 +02:00
Christian Göttsche 3451b6c6b8 FreeBSD: calculate whether to show entry last
Wait until it has been decided what kind of task the entry actually is.
2021-07-18 07:47:16 +02:00