Skip to content

Commit

Permalink
Apply patch from BenBE as per #241 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Lange authored and Daniel Lange committed Nov 16, 2020
1 parent 0951090 commit 8f2d129
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
18 changes: 7 additions & 11 deletions ProcessList.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 0 additions & 1 deletion ProcessList.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8f2d129

Please sign in to comment.