diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-11-19 15:15:02 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2020-11-22 16:49:43 +0100 |
commit | 17eeb7573abe504a63e10621d67cae65e2f620aa (patch) | |
tree | dcc14fc867ce37340c905c1f0416cd183536c1bc /linux/LinuxProcessList.c | |
parent | be39de14dd324231cc0c255934787fb24f7b9185 (diff) |
LinuxProcessList: skip parsing threads if the kind of thread is disabled
Diffstat (limited to 'linux/LinuxProcessList.c')
-rw-r--r-- | linux/LinuxProcessList.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index 7be54160..b31edb2d 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -1026,6 +1026,29 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char* xSnprintf(subdirname, MAX_NAME, "%s/%s/task", dirname, name); LinuxProcessList_recurseProcTree(this, subdirname, proc, period, tv); + /* + * These conditions will not trigger on first occurence, cause we need to + * add the process to the ProcessList and do all one time scans + * (e.g. parsing the cmdline to detect a kernel thread) + * But it will short-circuit subsequent scans. + */ + if (preExisting && hideKernelThreads && Process_isKernelThread(proc)) { + proc->updated = true; + proc->show = false; + pl->kernelThreads++; + pl->totalTasks++; + continue; + } + if (preExisting && hideUserlandThreads && Process_isUserlandThread(proc)) { + proc->updated = true; + proc->show = false; + pl->userlandThreads++; + pl->totalTasks++; + continue; + } + + proc->show = true; + #ifdef HAVE_TASKSTATS if (settings->flags & PROCESS_FLAG_IO) LinuxProcessList_readIoFile(lp, dirname, name, now); @@ -1049,8 +1072,6 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char* } } - proc->show = ! ((hideKernelThreads && Process_isKernelThread(proc)) || (hideUserlandThreads && Process_isUserlandThread(proc))); - char command[MAX_NAME + 1]; unsigned long long int lasttimes = (lp->utime + lp->stime); int commLen = sizeof(command); |