Prepare the way for making screen tabs more generalised,
able to cater to entities other than processes.
'actionTogglePauseProcessUpdate' -> 'actionTogglePauseUpdate'
'pauseProcessUpdate' -> 'pauseUpdate'
'hideProcessSelection' -> 'hideSelection'
'hideProcessSelection' -> 'hideSelection'
Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
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.
During SEGV handling under pcp-htop several incorrect strings were
observed - in particular reporting htop as the binary name instead
of pcp-htop. This is something we want to be crystal clear on when
we request user stack traces etc, so make sure this cannot be done
incorrectly.
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.
If the pkg-config check for hwloc succeeds, actually define
HAVE_LIBHWLOC to enable the conditional code.
Fixes: 4ccad460 ("configure.ac: fix static build with hwloc")
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)
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] 52b1364ba0
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.)
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