| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
Move host-centric data to new derived <Platform>Machine classes,
separate from process-list-centric data.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
On Linux, use zswap to populate "compressed memory" metrics added in the
previous commit.
Fixes #104.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.)
|
|
|
|
| |
Make them reusable for function defined earlier in the file.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This includes:
- Wrap function implementations
- Pointer alignment for function signatures
- Pointer alignment for variable declarations
- Whitespace after keywords
- Whitespace after comma
- Whitespace around initializers
- Whitespace around operators
- Code indentation
- Line break for single line statements
- Misleading alignment
|
|
|
|
| |
Co-authored-by: BenBE <BenBE@geshi.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add actionToggle and fix LinuxProcessList_checkPidNamespace
Read cgroup file irrespective of flags
Improve logic to check if running in container
Add isContainerOrVMSlice()
Also change "(Process *)lp" to "proc"
Remove check for root slice
Remove Process_isRunningInContainer
Co-authored-by: BenBE <BenBE@geshi.org>
|
|
|
|
| |
[ci skip]
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
linux/LinuxProcessList.c:1094:52: error: format specifies type 'char *' but the argument has type 'openat_arg_t' (aka 'int') [-Werror,-Wformat]
xSnprintf(filename, sizeof(filename), "%s/cwd", procFd);
~~ ^~~~~~
%d
linux/LinuxProcessList.c:1333:44: error: format specifies type 'char *' but the argument has type 'openat_arg_t' (aka 'int') [-Werror,-Wformat]
xSnprintf(path, sizeof(path), "%s/exe", procFd);
~~ ^~~~~~
%d
Supersedes: #1025
|
|
|
|
| |
Fixes #1008
|
| |
|
| |
|
|\ |
|
| |
| |
| |
| | |
Fixes the initial htoprc not being configured to amount for the host CPU count
|
| |
| |
| |
| | |
seeing the real host CPUs
|
| |
| |
| |
| |
| |
| |
| |
| | |
If a process goes away while reading its fields, but we already have
that process in the list, we should keep it in case the "highlight dying
processes" mode is active. Not only is that expected in this mode, but
this should also ensure parents are in the list when their children are
(wanted for tree mode consistency).
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A process can die between reading the directory listing and opening the
directory FD (if HAVE_OPENAT) or /proc files (otherwise) for reading the
process data. This race would cause LinuxProcessList_recurseProcTree to
remove it from the list immediately, which is unexpected in the
"highlight dying processes" mode and can break the tree structure.
This patch closes this race in the HAVE_OPENAT case by only accessing
the process entry after the directory FD has been opened.
|
|/
|
|
|
|
|
|
| |
whitespace)
man sscanf(3):
A sequence of white-space characters (space, tab, newline, etc.; see isspace(3)).
This directive matches any amount of white space, including none, in the input.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
SELinux contexts can be quite long; adjust the column width dynamically
at each cycle to the longest value.
Also with the recent addition of multiple screens, over-long columns can
be moved into their own screen.
|
|
|
|
| |
Fixes #935
|
|
|
|
|
| |
It's a memory map property, so it's process-wide and collecting it just
once should be enough.
|
|
|
|
| |
This is a forward port (by nathans) of Hisham's original code.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Use PF_KTHREAD flag in /proc/[pid]/stat to detect kernel threads.
This fixed an issue when a process's cmdline is empty, htop think
it is a kernel thread.
|
| |
|
|
|
|
|
| |
Virtualbox maps /dev/zero for memory allocation. That results in
false positive, so ignore.
|
|
|
|
|
|
|
|
|
|
| |
Add an explicit else clause so a following else branch for a prior if
condition does not get mixed up.
Also force a trailing semicolon and thereby silence current
-Wextra-semi-stmt warnings.
Improve readability of the hwloc_bitmap_foreach_begin loop macro.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
Defining O_PATH if not defined by <fcntl.h> does not really add any
maintenance cost and might improve some portability.
Related: #804
|
|/
|
|
|
|
|
|
| |
A process, whose executable has been replaced and thus marked by htop,
can be re-executed with the replaced executable, with the same PID, in
two ways: the Linux feature checkpoint/restore or re-execution of PID 1.
The actual check is just a string comparison, like the dropped
condition, leading to (almost) no computation overhead.
|