diff options
author | Daniel Lange <DLange@git.local> | 2020-11-16 12:17:28 +0100 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2020-11-16 12:55:32 +0100 |
commit | 8f2d129dcebe1e6aad1eb2d7147204d056e41619 (patch) | |
tree | 3e56e0ab848dadf208ffb886de1558100748e983 | |
parent | 0951090fa45255cd0ae0df907240868c31689014 (diff) |
Apply patch from BenBE as per https://github.com/htop-dev/htop/pull/241#issuecomment-720081138
-rw-r--r-- | ProcessList.c | 18 | ||||
-rw-r--r-- | ProcessList.h | 1 |
2 files changed, 7 insertions, 12 deletions
diff --git a/ProcessList.c b/ProcessList.c index a88c1e7b..8c3f6403 100644 --- a/ProcessList.c +++ b/ProcessList.c @@ -29,7 +29,6 @@ ProcessList* ProcessList_init(ProcessList* this, const ObjectClass* klass, Users this->cpuCount = 0; this->scanTs = 0; - this->firstScanTs = 0; #ifdef HAVE_LIBHWLOC this->topologyOk = false; @@ -91,12 +90,8 @@ void ProcessList_add(ProcessList* this, Process* p) { assert(Hashtable_get(this->processTable, p->pid) == NULL); p->processList = this; - if (this->scanTs == this->firstScanTs) { - // prevent highlighting processes found in first scan - p->seenTs = this->firstScanTs - this->settings->highlightDelaySecs - 1; - } else { - p->seenTs = this->scanTs; - } + // highlighting processes found in first scan by first scan marked "far in the past" + p->seenTs = this->scanTs; Vector_add(this->processes, p); Hashtable_put(this->processTable, p->pid, p); @@ -339,10 +334,11 @@ void ProcessList_scan(ProcessList* this, bool pauseProcessUpdate) { // set scanTs - if (clock_gettime(CLOCK_MONOTONIC, &now) == 0) { - if (this->firstScanTs == 0) { - this->firstScanTs = now.tv_sec; - } + static bool firstScanDone = false; + if (!firstScanDone) { + this->scanTs = 0; + firstScanDone = true; + } else if (clock_gettime(CLOCK_MONOTONIC, &now) == 0) { this->scanTs = now.tv_sec; } diff --git a/ProcessList.h b/ProcessList.h index db288104..a4b0cd6f 100644 --- a/ProcessList.h +++ b/ProcessList.h @@ -71,7 +71,6 @@ typedef struct ProcessList_ { int cpuCount; time_t scanTs; - time_t firstScanTs; } ProcessList; ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId); |