summaryrefslogtreecommitdiffstats
path: root/linux
Commit message (Collapse)AuthorAgeFilesLines
...
| * Update linux/LinuxProcessTable.cBowDown0972023-11-261-2/+2
| | | | | | Co-authored-by: BenBE <BenBE@geshi.org>
| * Use printKBytesBowDown0972023-11-242-2/+2
| |
| * Linux + PCP: Add private memory size columnBowDown0972023-11-244-0/+8
| |
* | Fix a little header comment typo in the CGroupUtils codeNathan Scott2023-11-271-1/+1
|/
* Remove unused zswap pool size calculation from commit 71f5a80d9eNathan Scott2023-11-212-22/+0
| | | | | Quick discussion with Ivan confirmed this was a left-over from an earlier version of the zswap code and can be safely removed.
* Shorten podman/libpod container IDs to 12 charactersBenny Baumann2023-11-191-0/+18
|
* Avoid OOB read when parsing process memory maps on LinuxBenny Baumann2023-11-081-0/+3
|
* Move shared memory next to used memoryKevin Bracey2023-10-261-1/+1
| | | | | | | | | Shared memory is less available than buffers, so move it left next to used memory. This is in preparation for including shared memory in the basic "in use" for the bar text. It would not make sense to sum a discontiguous region.
* Merge branch 'style-header-consistency' of https://github.com/BenBE/htop ↵Nathan Scott2023-10-109-9/+37
|\ | | | | | | into BenBE-style-header-consistency
| * Add missing copyright/file headersBenny Baumann2023-05-254-0/+28
| |
| * Make header sort order consistent againBenny Baumann2023-05-244-5/+5
| |
| * Always mark config.h with IWYU pragma: keepBenny Baumann2023-05-245-5/+5
| |
* | strchrnul is a GNU libc extension, add a wrapper for other platformsNathan Scott2023-10-102-7/+7
| |
* | Correct pid_t type return from Platform_getMaxPid functionNathan Scott2023-09-042-4/+4
| | | | | | | | | | | | | | Coverity scanning shows we end up passing an integer into the Row_setPidColumnWidth routine which requires a pid_t - update each platform to return the correct type (and never return -1 as a failure code, this was being ignored).
* | Rename ProcessList to ProcessTable throughoutNathan Scott2023-08-316-86/+86
| | | | | | | | | | | | | | | | | | | | | | | | Following up with some discusson from a few months back, where it was proposed that ProcessTable is a better name. This data structure is definitely not a list ... if it was one-dimensional it'd be a set, but in practice it has much more in common with a two-dimensional table. The Process table is a familiar operating system concept for many people too so it resonates a little in that way as well.
* | linux: right align IO_READ_RATE column titleChristian Göttsche2023-08-301-1/+1
| |
* | Support dynamic screens with 'top-most' entities beyond processesSohaib Mohamed2023-08-301-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements our concept of 'dynamic screens' in htop, with a first use-case of pcp-htop displaying things like top-filesystem and top-cgroups under new screen tabs. However the idea is more general than use in pcp-htop and we've paved the way here for us to collectively build mroe general tabular screens in core htop, as well. From the pcp-htop side of things, dynamic screens are configured using text-based configuration files that define the mapping for PCP metrics to columns (and metric instances to rows). Metrics are defined either directly (via metric names) or indirectly via PCP derived metric specifications. Value scaling and the units displayed is automatic based on PCP metric units and data types. This commit represents a collaborative effort of several months, primarily between myself, Nathan and BenBE. Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com> Signed-off-by: Nathan Scott <nathans@redhat.com>
* | Introduce Row and Table classes for screens beyond top-processesNathan Scott2023-08-305-86/+114
| | | | | | | | | | | | | | | | | | 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.
* | Rework ZramMeter and remove MeterClass.comprisedValuesExplorer092023-08-293-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | The 'comprisedValues' boolean property unnecessarily complicates the drawing algorithms of Bar meters and Graph meters. Since the only user of 'comprisedValues' is ZramMeter, it is better to rework the meter so that it no longer needs 'comprisedValues'. The 'values[ZRAM_METER_UNCOMPRESSED]' now stores the difference between uncompressed and compressed data size. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
* | 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-185-45/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | More robust logic for CPU process percentages (Linux & PCP)Explorer092023-08-181-9/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use saturatingSub() when subtracting CPU time and I/O read/write bytes of processes so that the values would never go negative (causing unsigned integer wraparound). * The CPU percentages of processes are now NaN if the time interval between measures (the "delta time") is zero. Make the conditional explicit and avoid division by zero. Previously the percentage values would be 0.0. Note: The saturatingSub() function is not used in cpu_delay_percent, blkio_delay_percent and swapin_delay_percent with a comment added that explains the reason. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
* | Merge branch 'remove-vla' of BenBE/htopDaniel Lange2023-08-021-2/+6
|\ \
| * | Header orderBenny Baumann2023-07-281-1/+2
| | |
| * | Avoid VLA in LibSensors codeBenny Baumann2023-07-281-1/+4
| | |
* | | Short-term fix for docker container detectionlestermfp2023-07-071-1/+1
|/ / | | | | https://github.com/htop-dev/htop/issues/1223
* / Fix Linux running tasks count in the Tasks Meter, a recent regressionNathan Scott2023-06-063-2/+8
|/ | | | | | | | | | | | | | The recent split of machine-wide metric gathering from process metrics gathering introduced a regression in the Linux running task accounting. The way we extract this value from /proc/stat (which typically is used for machine-wide metrics) conspired with a now-incorrectly placed init- to-zero at the start of the per-process sampling, caused this value to always be zero by the time the Tasks Meter used it. Fix this by making it much more clear that Linux has this special case handling of runningTasks. Resolves #1256
* Minor whitespace and small logic flow improvements on reviewNathan Scott2023-05-081-1/+1
| | | | Quality improvements from BenBE as part of review for #1234.
* Adapt platform code for the new Machine base classNathan Scott2023-05-089-856/+895
| | | | | Move host-centric data to new derived <Platform>Machine classes, separate from process-list-centric data.
* Introduce Machine class for host-specific info (split from ProcessList)Nathan Scott2023-05-086-71/+94
| | | | | | | | | | | 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: (hack) work around the fact that Zswapped pages may be SwapCachedIvan Shapovalov2023-04-231-0/+15
|
* Linux: implement zswap supportIvan Shapovalov2023-04-234-1/+65
| | | | | | | On Linux, use zswap to populate "compressed memory" metrics added in the previous commit. Fixes #104.
* Linux: fix include style issues for ZramStats.hIvan Shapovalov2023-04-232-1/+9
|
* {Memory,Swap}Meter: add "compressed memory" metricsIvan Shapovalov2023-04-231-0/+1
| | | | | | | | For now, the semantics are mostly fit for Linux zswap subsystem. For instance, we add the third swap usage metric that indicates the amount of memory that is accounted to swap but in fact stored elsewhere. This exactly matches the definition of frontswap/zswap, and is probably of little use to all other platforms.
* {Memory,Swap}Meter: make sure new constants are used consistentlyIvan Shapovalov2023-04-231-2/+2
|
* ZramMeter: update bar modeChristian Göttsche2023-04-113-12/+18
| | | | | | Show both compressed and uncompressed bars. Closes: #1216
* Minor code formatting consistency fixesBenny Baumann2023-04-113-9/+9
|
* Refactor and consolidate dynamic meters/columns pointersNathan Scott2023-04-062-3/+3
| | | | | | | | This removes the duplication of dynamic meter/column hashtable pointers that has come in between the Settings and ProcessList structures - only one copy of these is needed. With the future planned dynamic screens feature adding another pointer, let us first clean this up before any further duplication happens.
* Naming convention: LinuxProcess *lp and Process *process.Kirill Tkhai2023-03-311-26/+26
|
* This patch is for "Hide userland process threads mode is off" case.Kirill Tkhai2023-03-311-7/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Below is a small example of two threads program, whose main thread statistics is incorrect in htop. Despite main thread is permanently sleeping, its CPU load is 100% (must be 0%). CPU load of secondary thread is correct (100%). void *thread_func(void *data) { while(1) { } return NULL; } int main() { pthread_t thread; pthread_create(&thread, NULL, thread_func, NULL); pthread_join(thread, NULL); } The reason is in there is a difference in behavior of some files in /proc/pid and /proc/pid/task/pid directories. For example, /proc/pid/stat shows agregated user and sys times for all threads of a process. For the details please see do_task_stat() implementation and this function behavior difference in dependence of last argument: https://elixir.bootlin.com/linux/v6.2.8/source/fs/proc/array.c#L652 So, the problem occurs because of user and sys times of main thread are polluted by secondary thread statistics. This patch fixes the problem by reading correct stat from /proc/pid/task/pid/stat for main thread. Looking at other files from /proc/pid directory I found /proc/pid/io file with the same problem: https://elixir.bootlin.com/linux/v6.2.8/source/fs/proc/base.c#L3029 This problem is also fixed in this patch by reading correct data from /proc/pid/task/pid/io file for main thread. /proc/pid directory files are declared in tgid_base_stuff, while /proc/pid/task/tid directory files are declared in tid_base_stuff in kernel's fs/proc/base.c file: https://elixir.bootlin.com/linux/v6.2.8/source/fs/proc/base.c#L3238 I checked the difference between rest of declarations and it looks like there is no more problems of such type affecting htop.
* Improve CPU computation codeGuillaume Gomez2023-03-041-3/+2
|
* Improve code readability by using enum values instead of raw numbersGuillaume Gomez2023-03-041-5/+5
|
* Remove LXC special handling for the CPU countDaniel Lange2023-02-251-29/+1
| | | | | | | | | | | LXC shows the real host CPU ids but can be limited in configuration as to which cores are used. Still the sysfs files are visible and the CPUs (stay) marked online. We will need to parse /sys/devices/system/cpu/online to follow LXC's logic. Revert for now until we can come up with a better handling of the LXC hacks. Cf. issue #1195 Essentially reverting 33973f7e and 0d53245c (#993, #995)
* Implement File Descriptor Meter support for LinuxBenny Baumann2023-02-192-0/+22
|
* Misc cleanupChristian Göttsche2023-02-181-2/+1
| | | | | | * declare read-only pointer parameter const * drop duplicate include of <errno.h> * use String_startsWith
* Linux: add IRQ PSI meterMatthias Maier2023-02-133-0/+22
| | | | | | | | | | | | The linux kernel recently gained a new PSI meter, namely a new /proc/pressure/irq meter has been added [1]: full avg10=0.00 avg60=0.00 avg300=0.00 total=100648410 This commit adds support for this PSI meter by adding a PressureStallIRQFullMeter_class. [1] https://github.com/torvalds/linux/commit/52b1364ba0b105122d6de0e719b36db705011ac1
* Linux: highlight username if process has elevated privilegesChristian Göttsche2023-02-051-0/+8
| | | | | | Highlight processes started from binaries with file capabilities set, like kwin_wayland, or retaining Linux capabilities, via the ambient set, after switching from the root user, e.g. rtkit.
* Linux: Refactor /proc/<pid>/status parsingChristian Göttsche2023-02-051-124/+92
| | | | | | | Merge parsing /proc/<pid>/status for context switches, vserver ID and container detection into one function. (OpenVZ still does a separate cycle but is left as an exercise for someone actually using it.)
* Linux: move helper function to top of fileChristian Göttsche2023-02-051-42/+42
| | | | Make them reusable for function defined earlier in the file.
* Add support for scheduling policiesChristian Göttsche2023-02-052-0/+11
| | | | | | | | | | | | | Add a process column for scheduling policy to show the current scheduling policy of the process. Add a the ability to change the scheduling policy of a process via the key 'Y'. Currently implemented on Linux and FreeBSD only but should be portable, since sched_getscheduler(2) is part of POSIX.1-2001. Closes: #1161

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