diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-09-21 12:40:45 +0200 |
---|---|---|
committer | cgzones <cgzones@googlemail.com> | 2020-11-25 20:49:39 +0100 |
commit | 9b31ee5b63f2559d102a743082fe97440e5dc895 (patch) | |
tree | 3816d5841e59ce201b871cc49205dfd5590acda8 /linux | |
parent | c88c80e3bd0c858e4909412743064a4a1ed211b5 (diff) |
Drop taskstats conditional
taskstats is only checked on runtime if the column RCHAR, WCHAR, SYSCR,
SYSCW, RBYTES, WBYTES, CNCLWB, IO_READ_RATE, IO_WRITE_RATE or IO_RATE is
selected.
taskstats is currently enabled by default.
Drop the taskstats configuration switch, to reduce the maintenance cost.
Diffstat (limited to 'linux')
-rw-r--r-- | linux/LinuxProcess.c | 6 | ||||
-rw-r--r-- | linux/LinuxProcess.h | 4 | ||||
-rw-r--r-- | linux/LinuxProcessList.c | 13 |
3 files changed, 1 insertions, 22 deletions
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index 8cd59a5b..93d169e3 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -90,7 +90,6 @@ ProcessFieldData Process_fields[] = { #ifdef HAVE_VSERVER [VXID] = { .name = "VXID", .title = " VXID ", .description = "VServer process ID", .flags = PROCESS_FLAG_LINUX_VSERVER, }, #endif -#ifdef HAVE_TASKSTATS [RCHAR] = { .name = "RCHAR", .title = " RD_CHAR ", .description = "Number of bytes the process has read", .flags = PROCESS_FLAG_IO, }, [WCHAR] = { .name = "WCHAR", .title = " WR_CHAR ", .description = "Number of bytes the process has written", .flags = PROCESS_FLAG_IO, }, [SYSCR] = { .name = "SYSCR", .title = " RD_SYSC ", .description = "Number of read(2) syscalls for the process", .flags = PROCESS_FLAG_IO, }, @@ -101,7 +100,6 @@ ProcessFieldData Process_fields[] = { [IO_READ_RATE] = { .name = "IO_READ_RATE", .title = " DISK READ ", .description = "The I/O rate of read(2) in bytes per second for the process", .flags = PROCESS_FLAG_IO, }, [IO_WRITE_RATE] = { .name = "IO_WRITE_RATE", .title = " DISK WRITE ", .description = "The I/O rate of write(2) in bytes per second for the process", .flags = PROCESS_FLAG_IO, }, [IO_RATE] = { .name = "IO_RATE", .title = " DISK R/W ", .description = "Total I/O rate in bytes per second", .flags = PROCESS_FLAG_IO, }, -#endif [CGROUP] = { .name = "CGROUP", .title = " CGROUP ", .description = "Which cgroup the process is in", .flags = PROCESS_FLAG_LINUX_CGROUP, }, [OOM] = { .name = "OOM", .title = " OOM ", .description = "OOM (Out-of-Memory) killer score", .flags = PROCESS_FLAG_LINUX_OOM, }, [IO_PRIORITY] = { .name = "IO_PRIORITY", .title = "IO ", .description = "I/O priority", .flags = PROCESS_FLAG_LINUX_IOPRIO, }, @@ -646,7 +644,6 @@ static void LinuxProcess_writeField(const Process* this, RichString* str, Proces case STIME: Process_printTime(str, lp->stime); return; case CUTIME: Process_printTime(str, lp->cutime); return; case CSTIME: Process_printTime(str, lp->cstime); return; - #ifdef HAVE_TASKSTATS case RCHAR: Process_colorNumber(str, lp->io_rchar, coloring); return; case WCHAR: Process_colorNumber(str, lp->io_wchar, coloring); return; case SYSCR: Process_colorNumber(str, lp->io_syscr, coloring); return; @@ -668,7 +665,6 @@ static void LinuxProcess_writeField(const Process* this, RichString* str, Proces totalRate = NAN; Process_outputRate(str, buffer, n, totalRate, coloring); return; } - #endif #ifdef HAVE_OPENVZ case CTID: xSnprintf(buffer, n, "%-8s ", lp->ctid ? lp->ctid : ""); break; case VPID: xSnprintf(buffer, n, Process_pidFormat, lp->vpid); break; @@ -783,7 +779,6 @@ static long LinuxProcess_compare(const void* v1, const void* v2) { return SPACESHIP_NUMBER(p2->stime, p1->stime); case CSTIME: return SPACESHIP_NUMBER(p2->cstime, p1->cstime); - #ifdef HAVE_TASKSTATS case RCHAR: return SPACESHIP_NUMBER(p2->io_rchar, p1->io_rchar); case WCHAR: @@ -804,7 +799,6 @@ static long LinuxProcess_compare(const void* v1, const void* v2) { return SPACESHIP_NUMBER(p2->io_rate_write_bps, p1->io_rate_write_bps); case IO_RATE: return SPACESHIP_NUMBER(p2->io_rate_read_bps + p2->io_rate_write_bps, p1->io_rate_read_bps + p1->io_rate_write_bps); - #endif #ifdef HAVE_OPENVZ case CTID: return SPACESHIP_NULLSTR(p1->ctid, p2->ctid); diff --git a/linux/LinuxProcess.h b/linux/LinuxProcess.h index d843a0c8..4c23d13c 100644 --- a/linux/LinuxProcess.h +++ b/linux/LinuxProcess.h @@ -68,7 +68,6 @@ typedef enum LinuxProcessFields { #ifdef HAVE_VSERVER VXID = 102, #endif - #ifdef HAVE_TASKSTATS RCHAR = 103, WCHAR = 104, SYSCR = 105, @@ -79,7 +78,6 @@ typedef enum LinuxProcessFields { IO_READ_RATE = 110, IO_WRITE_RATE = 111, IO_RATE = 112, - #endif CGROUP = 113, OOM = 114, IO_PRIORITY = 115, @@ -148,7 +146,6 @@ typedef struct LinuxProcess_ { long m_drs; long m_lrs; long m_dt; - #ifdef HAVE_TASKSTATS unsigned long long io_rchar; unsigned long long io_wchar; unsigned long long io_syscr; @@ -160,7 +157,6 @@ typedef struct LinuxProcess_ { unsigned long long io_rate_write_time; double io_rate_read_bps; double io_rate_write_bps; - #endif #ifdef HAVE_OPENVZ char* ctid; pid_t vpid; diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index 506bea66..35fa8787 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -410,8 +410,6 @@ static bool LinuxProcessList_statProcessDir(Process* process, const char* dirnam return true; } -#ifdef HAVE_TASKSTATS - static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirname, const char* name, unsigned long long now) { char filename[MAX_NAME + 1]; filename[MAX_NAME] = '\0'; @@ -481,10 +479,6 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna } } -#endif - - - static bool LinuxProcessList_readStatmFile(LinuxProcess* process, const char* dirname, const char* name) { char filename[MAX_NAME + 1]; xSnprintf(filename, sizeof(filename), "%s/%s/statm", dirname, name); @@ -1130,14 +1124,11 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char* const struct dirent* entry; const Settings* settings = pl->settings; - #ifdef HAVE_TASKSTATS - unsigned long long now = tv.tv_sec * 1000LL + tv.tv_usec / 1000LL; - #endif - dir = opendir(dirname); if (!dir) return false; + unsigned long long now = tv.tv_sec * 1000ULL + tv.tv_usec / 1000ULL; int cpus = pl->cpuCount; bool hideKernelThreads = settings->hideKernelThreads; bool hideUserlandThreads = settings->hideUserlandThreads; @@ -1200,10 +1191,8 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char* continue; } - #ifdef HAVE_TASKSTATS if (settings->flags & PROCESS_FLAG_IO) LinuxProcessList_readIoFile(lp, dirname, name, now); - #endif if (! LinuxProcessList_readStatmFile(lp, dirname, name)) goto errorReadingProcess; |