From d145a3bfdd750e5f91c9d5794efab1ab9f76803d Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Sun, 28 Jan 2018 22:33:26 -0200 Subject: Use screen's flags when reading process data --- Settings.c | 1 - Settings.h | 1 - linux/LinuxProcess.c | 1 - linux/LinuxProcess.h | 1 - linux/LinuxProcessList.c | 13 +++++++------ 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Settings.c b/Settings.c index afc76a77..760e2876 100644 --- a/Settings.c +++ b/Settings.c @@ -48,7 +48,6 @@ typedef struct Settings_ { unsigned int ssIndex; ScreenSettings* ss; - int flags; int colorScheme; int delay; diff --git a/Settings.h b/Settings.h index 9687e12f..80ec9560 100644 --- a/Settings.h +++ b/Settings.h @@ -39,7 +39,6 @@ typedef struct Settings_ { unsigned int ssIndex; ScreenSettings* ss; - int flags; int colorScheme; int delay; diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index 3bfc697d..c646cdc7 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -475,4 +475,3 @@ long LinuxProcess_compare(const void* v1, const void* v2) { bool Process_isThread(Process* this) { return (Process_isUserlandThread(this) || Process_isKernelThread(this)); } - diff --git a/linux/LinuxProcess.h b/linux/LinuxProcess.h index 9400d7be..5995dafb 100644 --- a/linux/LinuxProcess.h +++ b/linux/LinuxProcess.h @@ -176,5 +176,4 @@ long LinuxProcess_compare(const void* v1, const void* v2); bool Process_isThread(Process* this); - #endif diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index 6f2631af..753a478e 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -755,6 +755,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char* DIR* dir; struct dirent* entry; Settings* settings = pl->settings; + ScreenSettings* ss = settings->ss; time_t curTime = tv.tv_sec; #ifdef HAVE_TASKSTATS @@ -800,7 +801,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char* LinuxProcessList_recurseProcTree(this, subdirname, proc, period, tv); #ifdef HAVE_TASKSTATS - if (settings->flags & PROCESS_FLAG_IO) + if (ss->flags & PROCESS_FLAG_IO) LinuxProcessList_readIoFile(lp, dirname, name, now); #endif @@ -819,7 +820,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char* free(lp->ttyDevice); lp->ttyDevice = LinuxProcessList_updateTtyDevice(this->ttyDrivers, proc->tty_nr); } - if (settings->flags & PROCESS_FLAG_LINUX_IOPRIO) + if (ss->flags & PROCESS_FLAG_LINUX_IOPRIO) LinuxProcess_updateIOPriority(lp); float percent_cpu = (lp->utime + lp->stime - lasttimes) / period * 100.0; proc->percent_cpu = CLAMP(percent_cpu, 0.0, cpus * 100.0); @@ -834,13 +835,13 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char* proc->user = UsersTable_getRef(pl->usersTable, proc->st_uid); #ifdef HAVE_OPENVZ - if (settings->flags & PROCESS_FLAG_LINUX_OPENVZ) { + if (ss->flags & PROCESS_FLAG_LINUX_OPENVZ) { LinuxProcessList_readOpenVZData(lp, dirname, name); } #endif #ifdef HAVE_VSERVER - if (settings->flags & PROCESS_FLAG_LINUX_VSERVER) { + if (ss->flags & PROCESS_FLAG_LINUX_VSERVER) { LinuxProcessList_readVServerData(lp, dirname, name); } #endif @@ -863,11 +864,11 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char* #endif #ifdef HAVE_CGROUP - if (settings->flags & PROCESS_FLAG_LINUX_CGROUP) + if (ss->flags & PROCESS_FLAG_LINUX_CGROUP) LinuxProcessList_readCGroupFile(lp, dirname, name); #endif - if (settings->flags & PROCESS_FLAG_LINUX_OOM) + if (ss->flags & PROCESS_FLAG_LINUX_OOM) LinuxProcessList_readOomData(lp, dirname, name); if (proc->state == 'Z' && (proc->basenameOffset == 0)) { -- cgit v1.2.3