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.
This commit is contained in:
Christian Göttsche 2020-09-21 12:40:45 +02:00 committed by cgzones
parent c88c80e3bd
commit 9b31ee5b63
6 changed files with 11 additions and 38 deletions

View File

@ -12,11 +12,11 @@ jobs:
- name: Bootstrap - name: Bootstrap
run: ./autogen.sh run: ./autogen.sh
- name: Configure - name: Configure
run: ./configure --enable-werror --enable-linux-affinity --disable-taskstats --disable-unicode --disable-sensors run: ./configure --enable-werror --enable-linux-affinity --disable-unicode --disable-sensors
- name: Build - name: Build
run: make -k run: make -k
- name: Distcheck - name: Distcheck
run: make distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-werror --enable-linux-affinity --disable-taskstats --disable-unicode --disable-sensors" run: make distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-werror --enable-linux-affinity --disable-unicode --disable-sensors"
build-ubuntu-latest-minimal-clang: build-ubuntu-latest-minimal-clang:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -34,11 +34,11 @@ jobs:
- name: Bootstrap - name: Bootstrap
run: ./autogen.sh run: ./autogen.sh
- name: Configure - name: Configure
run: ./configure --enable-werror --enable-linux-affinity --disable-taskstats --disable-unicode --disable-sensors run: ./configure --enable-werror --enable-linux-affinity --disable-unicode --disable-sensors
- name: Build - name: Build
run: make -k run: make -k
- name: Distcheck - name: Distcheck
run: make distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-werror --enable-linux-affinity --disable-taskstats --disable-unicode --disable-sensors" run: make distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-werror --enable-linux-affinity --disable-unicode --disable-sensors"
build-ubuntu-latest-full-featured-gcc: build-ubuntu-latest-full-featured-gcc:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -49,11 +49,11 @@ jobs:
- name: Bootstrap - name: Bootstrap
run: ./autogen.sh run: ./autogen.sh
- name: Configure - name: Configure
run: ./configure --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-taskstats --enable-unicode --enable-hwloc --enable-setuid --enable-delayacct --enable-sensors run: ./configure --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-unicode --enable-hwloc --enable-setuid --enable-delayacct --enable-sensors
- name: Build - name: Build
run: make -k run: make -k
- name: Distcheck - name: Distcheck
run: make distcheck DISTCHECK_CONFIGURE_FLAGS='--enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-taskstats --enable-unicode --enable-hwloc --enable-setuid --enable-delayacct --enable-sensors' run: make distcheck DISTCHECK_CONFIGURE_FLAGS='--enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-unicode --enable-hwloc --enable-setuid --enable-delayacct --enable-sensors'
build-ubuntu-latest-full-featured-clang: build-ubuntu-latest-full-featured-clang:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -71,11 +71,11 @@ jobs:
- name: Bootstrap - name: Bootstrap
run: ./autogen.sh run: ./autogen.sh
- name: Configure - name: Configure
run: ./configure --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-taskstats --enable-unicode --enable-hwloc --enable-setuid --enable-delayacct --enable-sensors run: ./configure --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-unicode --enable-hwloc --enable-setuid --enable-delayacct --enable-sensors
- name: Build - name: Build
run: make -k run: make -k
- name: Distcheck - name: Distcheck
run: make distcheck DISTCHECK_CONFIGURE_FLAGS='--enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-taskstats --enable-unicode --enable-hwloc --enable-setuid --enable-delayacct --enable-sensors' run: make distcheck DISTCHECK_CONFIGURE_FLAGS='--enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-unicode --enable-hwloc --enable-setuid --enable-delayacct --enable-sensors'
build-ubuntu-latest-clang-analyzer: build-ubuntu-latest-clang-analyzer:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -93,7 +93,7 @@ jobs:
- name: Bootstrap - name: Bootstrap
run: ./autogen.sh run: ./autogen.sh
- name: Configure - name: Configure
run: scan-build-11 -analyze-headers --status-bugs ./configure --enable-debug --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-taskstats --enable-unicode --enable-hwloc --enable-setuid --enable-delayacct --enable-sensors run: scan-build-11 -analyze-headers --status-bugs ./configure --enable-debug --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-unicode --enable-hwloc --enable-setuid --enable-delayacct --enable-sensors
- name: Build - name: Build
run: scan-build-11 -analyze-headers --status-bugs make -j"$(nproc)" run: scan-build-11 -analyze-headers --status-bugs make -j"$(nproc)"

View File

@ -280,7 +280,7 @@ coverage:
$(MAKE) all AM_CPPFLAGS="-fprofile-arcs -ftest-coverage -DDEBUG" AM_LDFLAGS="-lgcov" $(MAKE) all AM_CPPFLAGS="-fprofile-arcs -ftest-coverage -DDEBUG" AM_LDFLAGS="-lgcov"
cppcheck: cppcheck:
cppcheck -q -v . --enable=all -DHAVE_OPENVZ -DHAVE_TASKSTATS cppcheck -q -v . --enable=all -DHAVE_OPENVZ
dist-hook: $(top_distdir)/configure dist-hook: $(top_distdir)/configure
@if grep 'pkg_m4_absent' '$(top_distdir)/configure'; then \ @if grep 'pkg_m4_absent' '$(top_distdir)/configure'; then \

View File

@ -134,11 +134,6 @@ if test "x$enable_ancient_vserver" = xyes; then
AC_DEFINE(HAVE_ANCIENT_VSERVER, 1, [Define if ancient vserver support enabled.]) AC_DEFINE(HAVE_ANCIENT_VSERVER, 1, [Define if ancient vserver support enabled.])
fi fi
AC_ARG_ENABLE(taskstats, [AS_HELP_STRING([--enable-taskstats], [enable per-task IO Stats (taskstats kernel sup required)])], ,enable_taskstats="yes")
if test "x$enable_taskstats" = xyes; then
AC_DEFINE(HAVE_TASKSTATS, 1, [Define if taskstats support enabled.])
fi
# HTOP_CHECK_SCRIPT(LIBNAME, FUNCTION, DEFINE, CONFIG_SCRIPT, ELSE_PART) # HTOP_CHECK_SCRIPT(LIBNAME, FUNCTION, DEFINE, CONFIG_SCRIPT, ELSE_PART)
m4_define([HTOP_CHECK_SCRIPT], m4_define([HTOP_CHECK_SCRIPT],
[ [
@ -387,7 +382,6 @@ AC_MSG_RESULT([
(Linux) openvz: $enable_openvz (Linux) openvz: $enable_openvz
(Linux) vserver: $enable_vserver (Linux) vserver: $enable_vserver
(Linux) ancient vserver: $enable_ancient_vserver (Linux) ancient vserver: $enable_ancient_vserver
(Linux) taskstats: $enable_taskstats
(Linux) affinity: $enable_linux_affinity (Linux) affinity: $enable_linux_affinity
(Linux) delay accounting: $enable_delayacct (Linux) delay accounting: $enable_delayacct
(Linux) sensors: $enable_sensors (Linux) sensors: $enable_sensors

View File

@ -90,7 +90,6 @@ ProcessFieldData Process_fields[] = {
#ifdef HAVE_VSERVER #ifdef HAVE_VSERVER
[VXID] = { .name = "VXID", .title = " VXID ", .description = "VServer process ID", .flags = PROCESS_FLAG_LINUX_VSERVER, }, [VXID] = { .name = "VXID", .title = " VXID ", .description = "VServer process ID", .flags = PROCESS_FLAG_LINUX_VSERVER, },
#endif #endif
#ifdef HAVE_TASKSTATS
[RCHAR] = { .name = "RCHAR", .title = " RD_CHAR ", .description = "Number of bytes the process has read", .flags = PROCESS_FLAG_IO, }, [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, }, [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, }, [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_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_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, }, [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, }, [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, }, [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, }, [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 STIME: Process_printTime(str, lp->stime); return;
case CUTIME: Process_printTime(str, lp->cutime); return; case CUTIME: Process_printTime(str, lp->cutime); return;
case CSTIME: Process_printTime(str, lp->cstime); return; case CSTIME: Process_printTime(str, lp->cstime); return;
#ifdef HAVE_TASKSTATS
case RCHAR: Process_colorNumber(str, lp->io_rchar, coloring); return; case RCHAR: Process_colorNumber(str, lp->io_rchar, coloring); return;
case WCHAR: Process_colorNumber(str, lp->io_wchar, coloring); return; case WCHAR: Process_colorNumber(str, lp->io_wchar, coloring); return;
case SYSCR: Process_colorNumber(str, lp->io_syscr, 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; totalRate = NAN;
Process_outputRate(str, buffer, n, totalRate, coloring); return; Process_outputRate(str, buffer, n, totalRate, coloring); return;
} }
#endif
#ifdef HAVE_OPENVZ #ifdef HAVE_OPENVZ
case CTID: xSnprintf(buffer, n, "%-8s ", lp->ctid ? lp->ctid : ""); break; case CTID: xSnprintf(buffer, n, "%-8s ", lp->ctid ? lp->ctid : ""); break;
case VPID: xSnprintf(buffer, n, Process_pidFormat, lp->vpid); 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); return SPACESHIP_NUMBER(p2->stime, p1->stime);
case CSTIME: case CSTIME:
return SPACESHIP_NUMBER(p2->cstime, p1->cstime); return SPACESHIP_NUMBER(p2->cstime, p1->cstime);
#ifdef HAVE_TASKSTATS
case RCHAR: case RCHAR:
return SPACESHIP_NUMBER(p2->io_rchar, p1->io_rchar); return SPACESHIP_NUMBER(p2->io_rchar, p1->io_rchar);
case WCHAR: 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); return SPACESHIP_NUMBER(p2->io_rate_write_bps, p1->io_rate_write_bps);
case IO_RATE: 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); 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 #ifdef HAVE_OPENVZ
case CTID: case CTID:
return SPACESHIP_NULLSTR(p1->ctid, p2->ctid); return SPACESHIP_NULLSTR(p1->ctid, p2->ctid);

View File

@ -68,7 +68,6 @@ typedef enum LinuxProcessFields {
#ifdef HAVE_VSERVER #ifdef HAVE_VSERVER
VXID = 102, VXID = 102,
#endif #endif
#ifdef HAVE_TASKSTATS
RCHAR = 103, RCHAR = 103,
WCHAR = 104, WCHAR = 104,
SYSCR = 105, SYSCR = 105,
@ -79,7 +78,6 @@ typedef enum LinuxProcessFields {
IO_READ_RATE = 110, IO_READ_RATE = 110,
IO_WRITE_RATE = 111, IO_WRITE_RATE = 111,
IO_RATE = 112, IO_RATE = 112,
#endif
CGROUP = 113, CGROUP = 113,
OOM = 114, OOM = 114,
IO_PRIORITY = 115, IO_PRIORITY = 115,
@ -148,7 +146,6 @@ typedef struct LinuxProcess_ {
long m_drs; long m_drs;
long m_lrs; long m_lrs;
long m_dt; long m_dt;
#ifdef HAVE_TASKSTATS
unsigned long long io_rchar; unsigned long long io_rchar;
unsigned long long io_wchar; unsigned long long io_wchar;
unsigned long long io_syscr; unsigned long long io_syscr;
@ -160,7 +157,6 @@ typedef struct LinuxProcess_ {
unsigned long long io_rate_write_time; unsigned long long io_rate_write_time;
double io_rate_read_bps; double io_rate_read_bps;
double io_rate_write_bps; double io_rate_write_bps;
#endif
#ifdef HAVE_OPENVZ #ifdef HAVE_OPENVZ
char* ctid; char* ctid;
pid_t vpid; pid_t vpid;

View File

@ -410,8 +410,6 @@ static bool LinuxProcessList_statProcessDir(Process* process, const char* dirnam
return true; return true;
} }
#ifdef HAVE_TASKSTATS
static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirname, const char* name, unsigned long long now) { static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirname, const char* name, unsigned long long now) {
char filename[MAX_NAME + 1]; char filename[MAX_NAME + 1];
filename[MAX_NAME] = '\0'; 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) { static bool LinuxProcessList_readStatmFile(LinuxProcess* process, const char* dirname, const char* name) {
char filename[MAX_NAME + 1]; char filename[MAX_NAME + 1];
xSnprintf(filename, sizeof(filename), "%s/%s/statm", dirname, name); 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 struct dirent* entry;
const Settings* settings = pl->settings; const Settings* settings = pl->settings;
#ifdef HAVE_TASKSTATS
unsigned long long now = tv.tv_sec * 1000LL + tv.tv_usec / 1000LL;
#endif
dir = opendir(dirname); dir = opendir(dirname);
if (!dir) if (!dir)
return false; return false;
unsigned long long now = tv.tv_sec * 1000ULL + tv.tv_usec / 1000ULL;
int cpus = pl->cpuCount; int cpus = pl->cpuCount;
bool hideKernelThreads = settings->hideKernelThreads; bool hideKernelThreads = settings->hideKernelThreads;
bool hideUserlandThreads = settings->hideUserlandThreads; bool hideUserlandThreads = settings->hideUserlandThreads;
@ -1200,10 +1191,8 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
continue; continue;
} }
#ifdef HAVE_TASKSTATS
if (settings->flags & PROCESS_FLAG_IO) if (settings->flags & PROCESS_FLAG_IO)
LinuxProcessList_readIoFile(lp, dirname, name, now); LinuxProcessList_readIoFile(lp, dirname, name, now);
#endif
if (! LinuxProcessList_readStatmFile(lp, dirname, name)) if (! LinuxProcessList_readStatmFile(lp, dirname, name))
goto errorReadingProcess; goto errorReadingProcess;