From 6cfa9e0bf2ded1add3f018986268d9b1c3b119b6 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Fri, 24 May 2013 22:46:01 +0000 Subject: Performance improvements due to conditional parsing of IO data depending on selected fields. On my machine, this gives a ~20% improvement in htop process time use with the default config. --- Process.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'Process.c') diff --git a/Process.c b/Process.c index af56b704..6765be7a 100644 --- a/Process.c +++ b/Process.c @@ -45,6 +45,12 @@ in the source distribution for its full text. #include "IOPriority.h" #include +#define PROCESS_FLAG_IO 1 +#define PROCESS_FLAG_IOPRIO 2 +#define PROCESS_FLAG_OPENVZ 4 +#define PROCESS_FLAG_VSERVER 8 +#define PROCESS_FLAG_CGROUP 16 + #ifndef Process_isKernelThread #define Process_isKernelThread(_process) (_process->pgrp == 0) #endif @@ -201,6 +207,31 @@ const char *Process_fieldNames[] = { "*** report bug! ***" }; +const int Process_fieldFlags[] = { + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, +#ifdef HAVE_OPENVZ + PROCESS_FLAG_OPENVZ, PROCESS_FLAG_OPENVZ, +#endif +#ifdef HAVE_VSERVER + PROCESS_FLAG_VSERVER, +#endif +#ifdef HAVE_TASKSTATS + PROCESS_FLAG_IO, PROCESS_FLAG_IO, PROCESS_FLAG_IO, PROCESS_FLAG_IO, PROCESS_FLAG_IO, PROCESS_FLAG_IO, PROCESS_FLAG_IO, + PROCESS_FLAG_IO, PROCESS_FLAG_IO, PROCESS_FLAG_IO, +#endif +#ifdef HAVE_CGROUP + PROCESS_FLAG_CGROUP, +#endif + PROCESS_FLAG_IOPRIO +}; + const char *Process_fieldTitles[] = { "", " PID ", "Command ", "S ", " PPID ", " PGRP ", " SESN ", " TTY ", " TPGID ", "- ", "- ", "- ", "- ", "- ", -- cgit v1.2.3