mirror of https://github.com/xzeldon/htop.git
Adds support for counting user and kernel threads.
This commit is contained in:
parent
336acb0309
commit
5fe9bcb21c
|
@ -122,7 +122,7 @@ static void NetBSDProcessList_updateExe(const struct kinfo_proc2* kproc, Process
|
||||||
Process_updateExe(proc, NULL);
|
Process_updateExe(proc, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printf("%s\n", buffer);
|
|
||||||
/* Kernel threads return an empty buffer */
|
/* Kernel threads return an empty buffer */
|
||||||
if (buffer[0] == '\0') {
|
if (buffer[0] == '\0') {
|
||||||
Process_updateExe(proc, NULL);
|
Process_updateExe(proc, NULL);
|
||||||
|
@ -227,6 +227,7 @@ static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) {
|
||||||
proc->show = ! ((hideKernelThreads && Process_isKernelThread(proc)) || (hideUserlandThreads && Process_isUserlandThread(proc)));
|
proc->show = ! ((hideKernelThreads && Process_isKernelThread(proc)) || (hideUserlandThreads && Process_isUserlandThread(proc)));
|
||||||
|
|
||||||
if (!preExisting) {
|
if (!preExisting) {
|
||||||
|
proc->pid = kproc->p_pid;
|
||||||
proc->ppid = kproc->p_ppid;
|
proc->ppid = kproc->p_ppid;
|
||||||
proc->tpgid = kproc->p_tpgid;
|
proc->tpgid = kproc->p_tpgid;
|
||||||
proc->tgid = kproc->p_pid;
|
proc->tgid = kproc->p_pid;
|
||||||
|
@ -291,6 +292,12 @@ static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) {
|
||||||
default: proc->state = '?';
|
default: proc->state = '?';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Process_isKernelThread(proc)) {
|
||||||
|
this->super.kernelThreads++;
|
||||||
|
} else if (Process_isUserlandThread(proc)) {
|
||||||
|
this->super.userlandThreads++;
|
||||||
|
}
|
||||||
|
|
||||||
this->super.totalTasks++;
|
this->super.totalTasks++;
|
||||||
// SRUN ('R') means runnable, not running
|
// SRUN ('R') means runnable, not running
|
||||||
if (proc->state == 'P') {
|
if (proc->state == 'P') {
|
||||||
|
|
Loading…
Reference in New Issue