Commit Graph

139 Commits

Author SHA1 Message Date
Timofey Gelazoniya 36260b5814
CPU Temperature and Frequency meter for Linux platform 2022-06-07 22:16:47 +03:00
Hisham Muhammad 72ba20fa5f Introduce screen tabs
This is a forward port (by nathans) of Hisham's original code.
2021-12-07 17:04:49 +11:00
Benny Baumann 9dc964bb42 Compress cgroup names based on some heuristics 2021-11-28 20:19:10 +01:00
Alexander Momchilov dadcb87ad0 Extract Darwin "PlatformHelpers" 2021-09-26 10:58:47 -04:00
Nathan Scott 3d3474b3fc Adjust Makefile.am macro definitions for older automake versions
Fixes: #803
2021-09-23 10:06:38 +10:00
Christian Göttsche 9060a4179d Add option to change Header layout 2021-08-22 16:15:59 +02:00
Christian Göttsche b965417bf7 Add combined memory and swap meter
Closes: #699
2021-08-17 10:36:10 +02:00
Sohaib fefff80631 PCP: PCPMetric.[ch] Mdoule
Split the PCP Metric API (functions `Metric_*`) into their own module.
as @BenBE suggested.
2021-08-16 17:23:07 +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
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 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
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
Nathan Scott d4a2587568 Add time handling interfaces for the pcp platform
Related to https://github.com/htop-dev/htop/pull/574
2021-06-09 17:09:29 +10:00
Nathan Scott 5dfb524237 Implement command line and environment handling for pcp htop. 2021-06-09 17:09:29 +10:00
Sohaib e1d1a5cec6 Add ZFS ARC statistics and meters to the PCP platform 2021-06-09 17:09:29 +10:00
Nathan Scott c14a45ba35 Add a platform for Performance Co-Pilot (PCP) metrics
This introduces an initial platform for extracting metrics
using the PCP performance metrics API - PMAPI(3).  It can
be used via the --enable-pcp=yes configure option.

So far I've added support for live localhost metrics only,
and only using pre-defined metrics already found in htop.
If available, all sampling is performed by pmcd(1) - else,
we fallback to htop doing the metric sampling itself (all
below the PMAPI).  When pmcd is used, it may be configured
to run children with elevated privileges, so htop does not
need to be setuid (authentication with pmcd is available).

Additionally, the PMAPI allows us to support archives (for
historical analysis and for automated regression tests in
htop).  We'll need platform-specific command line argument
additions, which isn't yet feasible in htop (not difficult
to add though).

The goal of this first version is minimal impact in terms
of modifying the htop codebase, to introduce key ideas in
PCP (metric namespace, metadata, APIs and so on) and give
us something to discuss, experiment with and build on.
2021-06-09 17:09:29 +10:00
Nathan Scott 356488aa53 Request the realtime and monotonic clock times once per sample
Refactor the sample time code to make one call to gettimeofday
(aka the realtime clock in clock_gettime, when available) and
one to the monotonic clock.  Stores each in more appropriately
named ProcessList fields for ready access when needed.  Every
platform gets the opportunity to provide their own clock code,
and the existing Mac OS X specific code is moved below darwin
instead of in Compat.

A couple of leftover time(2) calls are converted to use these
ProcessList fields as well, instead of yet again sampling the
system clock.

Related to https://github.com/htop-dev/htop/pull/574
2021-04-05 23:41:07 +02:00
Nathan Scott 36389fb0da Abstract htop main function to allow for a platform binary
One review request relating to the PCP platform is to have
a clearly separate binary from the regular htop so that we
have no confusion as to what is being requested to run, to
aid debugging, and a bunch of other good reasons.

This commit renames htop.c to CommandLine.c and provides a
minimal htop main function for 'native' platforms to use.
The PCP version of this will setup libpcp.so and then call
the same CommandLine_run function as regular htop.

Related to https://github.com/htop-dev/htop/pull/536
2021-03-25 15:56:15 +11:00
Nathan Scott 61ef1134d9 Move generic (shared) code into its own sub-directory
Code that is shared across some (but not all) platforms
is moved into a 'generic' home. Makefile.am cleanups to
match plus some minor alphabetic reordering/formatting.

As discussed in https://github.com/htop-dev/htop/pull/553
2021-03-04 13:40:59 +11:00
Nathan Scott 5b50ae3aa3 Separate display from sampling in SysArch and Hostname Meters
Several of our newer meters have merged coding concerns in terms
of extracting values and displaying those values.  This commit
rectifies that for the SysArch and Hostname meters, allowing use
of this code with alternative front/back ends.  The SysArch code
is also refined to detect whether the platform has an os-release
file at all and/or the sys/utsname.h header via configure.ac.
2021-03-04 13:40:11 +11:00
Daniel Lange b1befa3287 Merge branch 'enable-better-debug-on-enable-debug' of fasterit/htop 2021-02-17 15:19:59 +01:00
Christian Göttsche f42090fcfd Drop empty file zfs/ZfsArcStats.c 2021-02-17 00:05:16 +01:00
Daniel Lange a89521ed7f Drop -DDEBUG (was removed in d69585b82a), add -Og for make debug target 2021-02-16 22:49:31 +01:00
Christian Göttsche 8bd543562b Quote SYSCONFDIR definition
As SYSCONFDIR is a compile time string literal, use compile time string
concatenation instead of a runtime one.

Also drop related TODO, cause we indeed using the correct way of getting
$sysconfdir from autoconf
2021-01-31 21:44:34 +01:00
ahgamut 51e79ddc07 [#480] SysArchMeter to view kernel/arch info
At start, SysArchMeter calls the uname function to obtain the kernel
version and architecture. If available, the distro version is obtained
by calling lsb_release. The obtained values are stored in static
variables and used when updating the meter.
2021-01-31 20:08:09 +01:00
Christian Göttsche f27bab470b Drop duplicate option
Option subdir-objects is now define in configure.ac
2021-01-28 23:40:37 +01:00
Christian Göttsche 38b6a0148f configure: misc modernizations
- require autoconf version 2.69
  was released in 2012 and one still can configure and build on older
  systems (just not generate the configure script)
- use modern C99 compiler check
- drop obsolete checks: AC_C_CONST, AC_FUNC_CLOSEDIR_VOID, AC_FUNC_STAT
- drop AC_HEADER_STDBOOL in favor of C99 compatibility
2021-01-25 17:57:21 +01:00
Christian Göttsche 4d85848988 Linux: handle hugepages
Subtract hugepages from normal memory.
Add a HugePageMeter.

Closes: #447
2021-01-19 18:06:48 +01:00
Christian Göttsche 8db8b9edac DragonFlyBSD update
- drop unused kinfo includes and link argument
- detect kvm library necessity at configure step
- fix variable typo
2020-12-20 18:22:41 +01:00
Christian Göttsche 89473cc9ae Rework enum ProcessField
Use only one enum instead of a global and a platform specific one.
Drop Platform_numberOfFields global variable.
Set known size of Process_fields array
2020-12-19 21:13:32 +01:00
Daniel Lange 8029e9af04 Update htop logo, provide .svg file as well 2020-12-05 13:46:34 +01:00
Christian Göttsche b76eaf187a Dynamically load libsensors at runtime 2020-12-02 21:03:24 +01:00
Christian Göttsche 9b31ee5b63 Drop taskstats conditional
taskstats is only checked on runtime if the column RCHAR, WCHAR, SYSCR,
SYSCW, RBYTES, WBYTES, CNCLWB, IO_READ_RATE, IO_WRITE_RATE or IO_RATE is
selected.

taskstats is currently enabled by default.

Drop the taskstats configuration switch, to reduce the maintenance cost.
2020-11-25 20:49:39 +01:00
Christian Göttsche c88c80e3bd Drop cgroup conditional
cgroup is only checked on runtime if the column CGROUP is selected.

cgroup is currently disabled by default, but most distributions do
enable it.

Drop the cgroup configuration switch, to reduce the maintenance cost.
2020-11-25 20:49:39 +01:00
Christian Göttsche 267014cbfe Add support to change numeric options in settings screen
Like delay or highlightDelaySecs
2020-11-25 20:46:27 +01:00
Benny Baumann d2c64c16e6 Fix build for custom make targets 2020-11-21 22:31:10 +01:00
Nathan Scott ea9622b8c9 Merge individual Battery.[ch] files into Platform.[ch]
Consistent with everything else involving platform-specific
calls from core htop code.
2020-11-18 10:17:33 +11:00
Daniel Lange f2b2735e07 Resolve merge conflicts, merge #229 "Add SystemdMeter" from @cgzones 2020-11-15 14:52:25 +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
Christian Göttsche 2a9e8ca074 Add SystemdMeter 2020-10-31 19:51:42 +01:00
Murloc Knight ab17ef4dc0 Zram Meter feature 2020-10-31 18:51:53 +01:00
Christian Göttsche bbf01054bf Add compat wrapper for fstatat 2020-10-29 22:21:42 +01:00
Benny Baumann 0f5262917f Make all required includes explicit
Information as seen by IWYU 0.12 + clang 9 on Linux
2020-10-18 20:09:05 +02:00
Benny Baumann 5e4b182616 Combine XAlloc.[ch] into XUtils.[ch] 2020-10-17 20:54:14 +02:00
Benny Baumann 872e542f4e Rename StringUtils.[ch] to XUtils.[ch] 2020-10-16 20:30:21 +02:00
Christian Göttsche 7cd093ce95 Add NetworkIOMeter 2020-10-16 20:00:14 +02:00
Christian Göttsche d744dac7ee Add SELinuxMeter 2020-10-16 19:20:07 +02:00