summaryrefslogtreecommitdiffstats
path: root/pcp/PCPProcess.c
Commit message (Collapse)AuthorAgeFilesLines
* Work around GCC14 memleak diagnosticBenny Baumann2024-04-081-1/+1
| | | | | While both pointers are identical, GCC-14 with -fanalyzer complains about these return statements to leak memory. The leak is only reported with LTO though.
* Introduce autoTitleRightAlign column flagChristian Göttsche2024-03-271-1/+1
| | | | | | Instead of handling PERCENT_CPU as a special case for whether to align the title of a dynamically sized column to the right or the left introduce a new flag, which can be reused by other columns.
* Use consistent style for process field output/compare functionsBenny Baumann2023-12-261-0/+3
|
* Add includes for config.h as per the discussion in PR #1337Daniel Lange2023-12-261-0/+2
| | | | | | Many thanks to @Explorer09 Kang-Che Sung (宋岡哲). Also add a #error stanza to XUtils.h in case somebody forgets the beautiful mess GNU forces on us.
* Add PCP supportBenny Baumann2023-12-111-0/+4
|
* Merge branch 'main' of https://github.com/BowDown097/htop into BowDown097-mainNathan Scott2023-11-271-0/+4
|\
| * Linux + PCP: Add private memory size columnBowDown0972023-11-241-0/+4
| |
* | PCP platform implementation of the compressed cgroup columnNathan Scott2023-11-271-2/+7
|/
* Introduce Row and Table classes for screens beyond top-processesNathan Scott2023-08-301-34/+41
| | | | | | | | | This commit refactors the Process and ProcessList structures such they each have a new parent - Row and Table, respectively. These new classes handle screen updates relating to anything that could be represented in tabular format, e.g. cgroups, filesystems, etc, without us having to reimplement the display logic repeatedly for each new entity.
* Compare all percentage fields with compareRealNumbers()Explorer092023-08-181-13/+3
| | | | | | | | The SPACESHIP_NUMBER() macro does not work well with floating point values that are possible to be NaNs. Change the compare logic of all percentage fields of Process entries to use compareRealNumbers(). Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
* Replace isnan() with better comparisons (isgreater(), etc.)Explorer092023-08-181-24/+28
| | | | | | | | | | | | | | | | | | The standard isnan() function is defined to never throw FP exceptions even when the argument is a "signaling" NaN. This makes isnan() more expensive than (x != x) expression unless the compiler flag '-fno-signaling-nans' is given. Introduce functions isNaN(), isNonnegative(), isPositive(), sumPositiveValues() and compareRealNumbers(), and replace isnan() in htop's codebase with the new functions. These functions utilize isgreater() and isgreaterequal() comparisons, which do not throw FP exceptions on "quiet" NaNs, which htop uses extensively. With isnan() removed, there is no need to suppress the warning '-Wno-c11-extensions' in FreeBSD. Remove the code from 'configure.ac'. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
* Minor data type fixes in Process.c and PCPProcess.cExplorer092023-08-181-2/+2
| | | | | | | | In PCPProcess_writeField(), the "n" variable should be size_t type. The "n" parameters of Process_printPercentage() and PCPProcess_printDelay() should be size_t type as well. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
* Introduce Machine class for host-specific info (split from ProcessList)Nathan Scott2023-05-081-3/+3
| | | | | | | | | | | First stage in sanitizing the process list structure so that htop can support other types of lists too (cgroups, filesystems, ...), in the not-too-distant future. This introduces struct Machine for system-wide information while keeping process-list information in ProcessList (now much less). Next step is to propogate this separation into each platform, to match these core changes.
* Linux: Increase field width of CPUD% and SWAPD% to 5Kumar2022-05-261-1/+1
| | | | | | | | | | | Title width of "CPUD%" and "SWAPD%" is 5 and there value cannot go beyond "100.0%", so increase their field width to 5. "IOD%" is similar to "MEM%" column, title width is 4 and maximum value cannot go beyond "100.0%". So in case of "IOD%" column, there is no need to increase title width to "5". "Process_printPercentage()" function will handle the maximum value case, it will display value beyond "99.9%" as "100" instead of "100.0".
* Process: Display single digit precision for CPU% greater than 99.9%Kumar2022-05-261-1/+1
| | | | | | | | | | | | | | | | | | | | Since commit edf319e[1], we're dynamically adjusting column width of "CPU%", showing single digit precision also for values greater than "99.9%" makes "CPU%" column consistent with all other values. [1]: edf319e53d1fb77546505e238d75160a3febe56e Change "Process_printPercentage()" function's logic to always display value (i.e. "val") with single precision. Except when value is greater than "99.9%" for columns like "MEM%", whose width is fixed to "4" and value cannot go beyond "100%". Credits: @Explorer09, thanks for the patch[2] to fix title alignment issue. [2]: https://github.com/htop-dev/htop/pull/959#issuecomment-1092480951 Closes: #957
* Auto-size (normalized) CPU usage columnsBenny Baumann2022-03-061-2/+2
|
* Dynamically scale the ST_UID size to support 32-bit UIDsSilke Hofstra2021-10-271-2/+2
| | | | | | | | | | | | | | | | | | While most Unix-like systems use 16-bit user IDs, Linux supports 32-bit UIDs since version 2.6. UIDs above 65535 are used for UID namespacing of containers, where a container has its own set of 16-bit user IDs. Processes in such containers will have (much) larger UIDs than 65535. Because the current format strings for `ST_UID` and `USER` are `%5d` and `%9d` respectively, processes with such UIDs lead to misaligned columns. Dynamically scale the `ST_UID` column and increase the size of `USER` to 10 characters (length of UINT32_MAX) to ensure that the user ID always fits. Additionally: clean up how the titlebuffer size calculation and ensure the PID column has a minimum size of 5.
* Update license headers to explicitly say GPLv2+Daniel Lange2021-09-221-1/+1
|
* PCP: PCPMetric.[ch] MdouleSohaib2021-08-161-1/+0
| | | | | Split the PCP Metric API (functions `Metric_*`) into their own module. as @BenBE suggested.
* Merge branch 'dynamic-columns' of https://github.com/smalinux/htop into ↵Nathan Scott2021-08-131-6/+11
|\ | | | | | | smalinux-dynamic-columns
| * PCP: support for 'dynamic columns' added at runtimeSohaib Mohamed2021-08-131-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Add columns for process autogroup identifier and nice valueNathan Scott2021-08-091-0/+25
|/ | | | | | | | | | | | 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
* Split statements that should go onto multiple linesBenny Baumann2021-07-151-1/+2
|
* PCP: Fix minor cut+paste typoSohaib Mohamed2021-06-301-5/+5
|
* Update platform-specific header includes to use pcp paths.Nathan Scott2021-06-091-1/+1
| | | | Resolves a couple of remaining review notes from @BenBE.
* Update the PCP platform to use common Process fields and codeNathan Scott2021-06-091-276/+28
| | | | | | | Remove code now that we have common platform-independent command line wrangling (thanks BenBE!). Add PCP platform support for a handful of other recently arriving odds and ends - ELAPSED time, CWD, and so on.
* Rework TTY column for the PCP platformNathan Scott2021-06-091-9/+1
|
* Add a platform for Performance Co-Pilot (PCP) metricsNathan Scott2021-06-091-0/+517
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.

© 2014-2024 Faster IT GmbH | imprint | privacy policy