mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
Pre-calculate isUserlandThread flag
This commit is contained in:
parent
cdb660adab
commit
1a1fddae85
@ -33,6 +33,7 @@ in the source distribution for its full text.
|
||||
typedef struct LinuxProcess_ {
|
||||
Process super;
|
||||
bool isKernelThread;
|
||||
bool isUserlandThread;
|
||||
IOPriority ioPriority;
|
||||
unsigned long int cminflt;
|
||||
unsigned long int cmajflt;
|
||||
@ -106,9 +107,7 @@ typedef struct LinuxProcess_ {
|
||||
|
||||
#define Process_isKernelThread(_process) (((const LinuxProcess*)(_process))->isKernelThread)
|
||||
|
||||
static inline bool Process_isUserlandThread(const Process* this) {
|
||||
return this->pid != this->tgid;
|
||||
}
|
||||
#define Process_isUserlandThread(_process) (((const LinuxProcess *)(_process))->isUserlandThread)
|
||||
|
||||
extern int pageSize;
|
||||
|
||||
|
@ -1315,6 +1315,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_
|
||||
LinuxProcess* lp = (LinuxProcess*) proc;
|
||||
|
||||
proc->tgid = parent ? parent->pid : pid;
|
||||
lp->isUserlandThread = proc->pid != proc->tgid;
|
||||
|
||||
#ifdef HAVE_OPENAT
|
||||
int procFd = openat(dirFd, entry->d_name, O_PATH | O_DIRECTORY | O_NOFOLLOW);
|
||||
|
Loading…
Reference in New Issue
Block a user