blob: 6339546a0392409cf0dc96d5d49e4191ca84ae94 [file] [log] [blame]
Hisham Muhammadd6231ba2006-03-04 18:16:49 +00001/*
2htop - ProcessList.c
3(C) 2004,2005 Hisham H. Muhammad
Daniel Lange079c2ab2020-10-05 09:51:32 +02004Released under the GNU GPLv2, see the COPYING file
Hisham Muhammadd6231ba2006-03-04 18:16:49 +00005in the source distribution for its full text.
6*/
7
Hisham Muhammadd6231ba2006-03-04 18:16:49 +00008#include "ProcessList.h"
Hisham Muhammadd6231ba2006-03-04 18:16:49 +00009
Benny Baumann0f526292020-09-19 13:55:23 +020010#include <assert.h>
Hisham Muhammad84281bd2011-12-26 21:35:57 +000011#include <string.h>
Adam Saponaradde71c62020-10-30 21:56:16 -040012#include <time.h>
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000013
Benny Baumann0f526292020-09-19 13:55:23 +020014#include "CRT.h"
15#include "XUtils.h"
16
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000017
Christian Göttsche08d85e62020-10-04 17:55:08 +020018ProcessList* ProcessList_init(ProcessList* this, const ObjectClass* klass, UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
Hisham Muhammadb291fba2015-04-09 15:40:27 -030019 this->processes = Vector_new(klass, true, DEFAULT_SIZE);
Hisham Muhammad7ca10812011-11-18 06:08:56 +000020 this->processTable = Hashtable_new(140, false);
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000021 this->usersTable = usersTable;
Nathan Scott45973322020-09-09 19:38:15 +100022 this->pidMatchList = pidMatchList;
Hisham Muhammad3383d8e2015-01-21 23:27:31 -020023 this->userId = userId;
Daniel Flanagandd334442019-10-31 11:39:12 -050024
Hisham Muhammadb291fba2015-04-09 15:40:27 -030025 // tree-view auxiliary buffer
26 this->processes2 = Vector_new(klass, true, DEFAULT_SIZE);
Daniel Flanagandd334442019-10-31 11:39:12 -050027
Hisham Muhammadeb229d92014-11-24 18:55:03 -020028 // set later by platform-specific code
29 this->cpuCount = 0;
Hisham Muhammadec17b702011-09-24 00:30:47 +000030
Adam Saponaradde71c62020-10-30 21:56:16 -040031 this->scanTs = 0;
Adam Saponaradde71c62020-10-30 21:56:16 -040032
Hisham Muhammadbc87a8f2011-11-21 02:52:41 +000033#ifdef HAVE_LIBHWLOC
Hisham Muhammadec17b702011-09-24 00:30:47 +000034 this->topologyOk = false;
Nathan Scott728b04b2020-08-26 10:15:00 +100035 if (hwloc_topology_init(&this->topology) == 0) {
36 this->topologyOk =
37 #if HWLOC_API_VERSION < 0x00020000
38 /* try to ignore the top-level machine object type */
39 0 == hwloc_topology_ignore_type_keep_structure(this->topology, HWLOC_OBJ_MACHINE) &&
40 /* ignore caches, which don't add structure */
41 0 == hwloc_topology_ignore_type_keep_structure(this->topology, HWLOC_OBJ_CORE) &&
42 0 == hwloc_topology_ignore_type_keep_structure(this->topology, HWLOC_OBJ_CACHE) &&
43 0 == hwloc_topology_set_flags(this->topology, HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM) &&
44 #else
45 0 == hwloc_topology_set_all_types_filter(this->topology, HWLOC_TYPE_FILTER_KEEP_STRUCTURE) &&
46 #endif
47 0 == hwloc_topology_load(this->topology);
Hisham Muhammadec17b702011-09-24 00:30:47 +000048 }
49#endif
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000050
Hisham Muhammad05a78c82012-03-30 01:20:32 +000051 this->following = -1;
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000052
53 return this;
54}
55
Hisham Muhammadcda6bdd2014-11-27 17:48:38 -020056void ProcessList_done(ProcessList* this) {
Hisham84a69b12016-02-29 21:57:27 -030057#ifdef HAVE_LIBHWLOC
58 if (this->topologyOk) {
59 hwloc_topology_destroy(this->topology);
60 }
61#endif
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000062 Hashtable_delete(this->processTable);
Hisham Muhammada853faa2006-05-30 13:45:40 +000063 Vector_delete(this->processes);
64 Vector_delete(this->processes2);
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000065}
66
Hisham Muhammadbfd86a62011-12-01 12:31:57 +000067void ProcessList_setPanel(ProcessList* this, Panel* panel) {
68 this->panel = panel;
69}
70
Hisham Muhammadd8e14802010-11-22 12:40:20 +000071void ProcessList_printHeader(ProcessList* this, RichString* header) {
72 RichString_prune(header);
Christian Göttschea3bb7cb2020-10-21 21:26:09 +020073 const ProcessField* fields = this->settings->fields;
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000074 for (int i = 0; fields[i]; i++) {
Hisham Muhammad3383d8e2015-01-21 23:27:31 -020075 const char* field = Process_fields[fields[i]].title;
Benny Baumann45869512020-11-01 01:09:51 +010076 if (!field) {
77 field = "- ";
78 }
79
Narendran Gopalakrishnane33d4d92020-11-09 18:38:51 +010080 int color = (!this->settings->treeView && this->settings->sortKey == fields[i]) ?
81 CRT_colors[PANEL_SELECTION_FOCUS] : CRT_colors[PANEL_HEADER_FOCUS];
82 RichString_append(header, color, field);
83 if (COMM == fields[i] && this->settings->showMergedCommand) {
84 RichString_append(header, color, "(merged)");
Benny Baumann45869512020-11-01 01:09:51 +010085 }
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000086 }
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000087}
88
Hisham Muhammadeb229d92014-11-24 18:55:03 -020089void ProcessList_add(ProcessList* this, Process* p) {
Hisham Muhammadfebe2592006-11-08 20:12:57 +000090 assert(Vector_indexOf(this->processes, p, Process_pidCompare) == -1);
91 assert(Hashtable_get(this->processTable, p->pid) == NULL);
Adam Saponaradde71c62020-10-30 21:56:16 -040092 p->processList = this;
93
Daniel Lange8f2d1292020-11-16 12:17:28 +010094 // highlighting processes found in first scan by first scan marked "far in the past"
95 p->seenTs = this->scanTs;
Daniel Flanagandd334442019-10-31 11:39:12 -050096
Hisham Muhammada853faa2006-05-30 13:45:40 +000097 Vector_add(this->processes, p);
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000098 Hashtable_put(this->processTable, p->pid, p);
Daniel Flanagandd334442019-10-31 11:39:12 -050099
Hisham Muhammadfebe2592006-11-08 20:12:57 +0000100 assert(Vector_indexOf(this->processes, p, Process_pidCompare) != -1);
101 assert(Hashtable_get(this->processTable, p->pid) != NULL);
Hisham Muhammad3d62edb2006-11-12 21:53:56 +0000102 assert(Hashtable_count(this->processTable) == Vector_count(this->processes));
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000103}
104
Hisham Muhammadeb229d92014-11-24 18:55:03 -0200105void ProcessList_remove(ProcessList* this, Process* p) {
Hisham Muhammadfebe2592006-11-08 20:12:57 +0000106 assert(Vector_indexOf(this->processes, p, Process_pidCompare) != -1);
107 assert(Hashtable_get(this->processTable, p->pid) != NULL);
Benny Baumann45869512020-11-01 01:09:51 +0100108
Hisham Muhammadfebe2592006-11-08 20:12:57 +0000109 Process* pp = Hashtable_remove(this->processTable, p->pid);
Hisham Muhammad8adc7ac2006-11-08 21:49:52 +0000110 assert(pp == p); (void)pp;
Benny Baumann45869512020-11-01 01:09:51 +0100111
Hisham Muhammada227b202007-04-05 19:53:23 +0000112 unsigned int pid = p->pid;
Hisham Muhammad8f230922010-02-25 01:37:31 +0000113 int idx = Vector_indexOf(this->processes, p, Process_pidCompare);
114 assert(idx != -1);
Benny Baumann45869512020-11-01 01:09:51 +0100115
116 if (idx >= 0) {
117 Vector_remove(this->processes, idx);
118 }
119
Hisham Muhammad8adc7ac2006-11-08 21:49:52 +0000120 assert(Hashtable_get(this->processTable, pid) == NULL); (void)pid;
Hisham Muhammad3d62edb2006-11-12 21:53:56 +0000121 assert(Hashtable_count(this->processTable) == Vector_count(this->processes));
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000122}
123
Hisham Muhammad8f230922010-02-25 01:37:31 +0000124Process* ProcessList_get(ProcessList* this, int idx) {
125 return (Process*) (Vector_get(this->processes, idx));
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000126}
127
128int ProcessList_size(ProcessList* this) {
Hisham Muhammada853faa2006-05-30 13:45:40 +0000129 return (Vector_size(this->processes));
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000130}
131
Hisham Muhammad9eb91212010-06-17 19:02:03 +0000132static void ProcessList_buildTree(ProcessList* this, pid_t pid, int level, int indent, int direction, bool show) {
Hisham Muhammad00b324b2012-12-05 15:12:20 +0000133 Vector* children = Vector_new(Class(Process), false, DEFAULT_SIZE);
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000134
Hisham Muhammadfebe2592006-11-08 20:12:57 +0000135 for (int i = Vector_size(this->processes) - 1; i >= 0; i--) {
Hisham Muhammada853faa2006-05-30 13:45:40 +0000136 Process* process = (Process*) (Vector_get(this->processes, i));
Hisham Muhammade3f65c82017-09-14 17:10:39 -0300137 if (process->show && Process_isChildOf(process, pid)) {
Hisham Muhammad8f230922010-02-25 01:37:31 +0000138 process = (Process*) (Vector_take(this->processes, i));
Hisham Muhammada853faa2006-05-30 13:45:40 +0000139 Vector_add(children, process);
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000140 }
141 }
Hisham Muhammada853faa2006-05-30 13:45:40 +0000142 int size = Vector_size(children);
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000143 for (int i = 0; i < size; i++) {
Hisham Muhammada853faa2006-05-30 13:45:40 +0000144 Process* process = (Process*) (Vector_get(children, i));
Benny Baumann45869512020-11-01 01:09:51 +0100145 if (!show) {
Hisham Muhammadd8e14802010-11-22 12:40:20 +0000146 process->show = false;
Benny Baumann45869512020-11-01 01:09:51 +0100147 }
148
Christian Göttschee9246ab2020-10-15 21:45:38 +0200149 int s = Vector_size(this->processes2);
Benny Baumann45869512020-11-01 01:09:51 +0100150 if (direction == 1) {
Hisham Muhammadd8e14802010-11-22 12:40:20 +0000151 Vector_add(this->processes2, process);
Benny Baumann45869512020-11-01 01:09:51 +0100152 } else {
Hisham Muhammadd8e14802010-11-22 12:40:20 +0000153 Vector_insert(this->processes2, 0, process);
Benny Baumann45869512020-11-01 01:09:51 +0100154 }
155
Christian Göttschee9246ab2020-10-15 21:45:38 +0200156 assert(Vector_size(this->processes2) == s+1); (void)s;
Benny Baumann45869512020-11-01 01:09:51 +0100157
Hisham Muhammadd8e14802010-11-22 12:40:20 +0000158 int nextIndent = indent | (1 << level);
Hisham Muhammad5effb122010-11-24 12:00:34 +0000159 ProcessList_buildTree(this, process->pid, level+1, (i < size - 1) ? nextIndent : indent, direction, show ? process->showChildren : false);
Benny Baumann45869512020-11-01 01:09:51 +0100160
161 if (i == size - 1) {
Hisham Muhammadca6b9232011-11-03 22:12:12 +0000162 process->indent = -nextIndent;
Benny Baumann45869512020-11-01 01:09:51 +0100163 } else {
Hisham Muhammadca6b9232011-11-03 22:12:12 +0000164 process->indent = nextIndent;
Benny Baumann45869512020-11-01 01:09:51 +0100165 }
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000166 }
Hisham Muhammada853faa2006-05-30 13:45:40 +0000167 Vector_delete(children);
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000168}
169
Christian Göttschea3bb7cb2020-10-21 21:26:09 +0200170static long ProcessList_treeProcessCompare(const void* v1, const void* v2) {
171 const Process *p1 = (const Process*)v1;
172 const Process *p2 = (const Process*)v2;
173
174 return p1->pid - p2->pid;
175}
176
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000177void ProcessList_sort(ProcessList* this) {
Hisham Muhammad3383d8e2015-01-21 23:27:31 -0200178 if (!this->settings->treeView) {
Hisham Muhammad7ca10812011-11-18 06:08:56 +0000179 Vector_insertionSort(this->processes);
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000180 } else {
Hisham Muhammada7c2aed2007-11-08 23:23:01 +0000181 // Save settings
Hisham Muhammad3383d8e2015-01-21 23:27:31 -0200182 int direction = this->settings->direction;
Hisham Muhammada7c2aed2007-11-08 23:23:01 +0000183 // Sort by PID
Christian Göttschea3bb7cb2020-10-21 21:26:09 +0200184 Vector_quickSortCustomCompare(this->processes, ProcessList_treeProcessCompare);
Hisham Muhammad3d62edb2006-11-12 21:53:56 +0000185 int vsize = Vector_size(this->processes);
wangqr584a9bc2017-09-01 21:27:24 +0800186 // Find all processes whose parent is not visible
187 int size;
188 while ((size = Vector_size(this->processes))) {
189 int i;
190 for (i = 0; i < size; i++) {
191 Process* process = (Process*)(Vector_get(this->processes, i));
192 // Immediately consume not shown processes
193 if (!process->show) {
194 process = (Process*)(Vector_take(this->processes, i));
195 process->indent = 0;
196 Vector_add(this->processes2, process);
197 ProcessList_buildTree(this, process->pid, 0, 0, direction, false);
198 break;
199 }
Hisham Muhammad0dbedf92018-04-05 19:31:18 -0300200 pid_t ppid = Process_getParentPid(process);
wangqr584a9bc2017-09-01 21:27:24 +0800201 // Bisect the process vector to find parent
202 int l = 0, r = size;
Wataru Ashiharab34d76c2018-01-02 23:15:45 +0900203 // If PID corresponds with PPID (e.g. "kernel_task" (PID:0, PPID:0)
204 // on Mac OS X 10.11.6) cancel bisecting and regard this process as
205 // root.
206 if (process->pid == ppid)
207 r = 0;
Benny Baumann45869512020-11-01 01:09:51 +0100208
wangqr584a9bc2017-09-01 21:27:24 +0800209 while (l < r) {
210 int c = (l + r) / 2;
211 pid_t pid = ((Process*)(Vector_get(this->processes, c)))->pid;
Hisham Muhammadb9934ff2017-09-04 13:53:03 -0300212 if (ppid == pid) {
wangqr584a9bc2017-09-01 21:27:24 +0800213 break;
Hisham Muhammadb9934ff2017-09-04 13:53:03 -0300214 } else if (ppid < pid) {
wangqr584a9bc2017-09-01 21:27:24 +0800215 r = c;
Hisham Muhammadb9934ff2017-09-04 13:53:03 -0300216 } else {
wangqr584a9bc2017-09-01 21:27:24 +0800217 l = c + 1;
Hisham Muhammadb9934ff2017-09-04 13:53:03 -0300218 }
wangqr584a9bc2017-09-01 21:27:24 +0800219 }
220 // If parent not found, then construct the tree with this root
221 if (l >= r) {
222 process = (Process*)(Vector_take(this->processes, i));
223 process->indent = 0;
224 Vector_add(this->processes2, process);
225 ProcessList_buildTree(this, process->pid, 0, 0, direction, process->showChildren);
226 break;
227 }
228 }
229 // There should be no loop in the process tree
230 assert(i < size);
Hisham Muhammad3d62edb2006-11-12 21:53:56 +0000231 }
232 assert(Vector_size(this->processes2) == vsize); (void)vsize;
233 assert(Vector_size(this->processes) == 0);
Hisham Muhammada7c2aed2007-11-08 23:23:01 +0000234 // Swap listings around
Hisham Muhammada853faa2006-05-30 13:45:40 +0000235 Vector* t = this->processes;
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000236 this->processes = this->processes2;
237 this->processes2 = t;
238 }
239}
240
Hisham Muhammad2338ad52008-03-14 18:50:49 +0000241
Christian Göttsche91317322020-11-04 17:46:11 +0100242ProcessField ProcessList_keyAt(const ProcessList* this, int at) {
Hisham Muhammad2338ad52008-03-14 18:50:49 +0000243 int x = 0;
Christian Göttschea3bb7cb2020-10-21 21:26:09 +0200244 const ProcessField* fields = this->settings->fields;
Hisham Muhammad2338ad52008-03-14 18:50:49 +0000245 ProcessField field;
246 for (int i = 0; (field = fields[i]); i++) {
Hisham Muhammad3383d8e2015-01-21 23:27:31 -0200247 const char* title = Process_fields[field].title;
Benny Baumann45869512020-11-01 01:09:51 +0100248 if (!title) {
249 title = "- ";
250 }
251
Hisham Muhammad3383d8e2015-01-21 23:27:31 -0200252 int len = strlen(title);
Hisham Muhammad2338ad52008-03-14 18:50:49 +0000253 if (at >= x && at <= x + len) {
254 return field;
255 }
256 x += len;
257 }
258 return COMM;
259}
Hisham Muhammad64862292010-08-24 23:20:38 +0000260
261void ProcessList_expandTree(ProcessList* this) {
262 int size = Vector_size(this->processes);
263 for (int i = 0; i < size; i++) {
264 Process* process = (Process*) Vector_get(this->processes, i);
265 process->showChildren = true;
266 }
267}
Hisham Muhammadbfd86a62011-12-01 12:31:57 +0000268
Hisham Muhammad3383d8e2015-01-21 23:27:31 -0200269void ProcessList_rebuildPanel(ProcessList* this) {
Hisham Muhammad3383d8e2015-01-21 23:27:31 -0200270 const char* incFilter = this->incFilter;
Hisham Muhammadbfd86a62011-12-01 12:31:57 +0000271
272 int currPos = Panel_getSelectedIndex(this->panel);
Hisham Muhammad3383d8e2015-01-21 23:27:31 -0200273 pid_t currPid = this->following != -1 ? this->following : 0;
Hisham Muhammadbfd86a62011-12-01 12:31:57 +0000274 int currScrollV = this->panel->scrollV;
Hisham Muhammadbfd86a62011-12-01 12:31:57 +0000275
276 Panel_prune(this->panel);
277 int size = ProcessList_size(this);
278 int idx = 0;
279 for (int i = 0; i < size; i++) {
280 bool hidden = false;
281 Process* p = ProcessList_get(this, i);
282
283 if ( (!p->show)
Hisham Muhammad3383d8e2015-01-21 23:27:31 -0200284 || (this->userId != (uid_t) -1 && (p->st_uid != this->userId))
Narendran Gopalakrishnan09fe94d2020-10-17 16:24:45 +0530285 || (incFilter && !(String_contains_i(Process_getCommand(p), incFilter)))
Nathan Scott45973322020-09-09 19:38:15 +1000286 || (this->pidMatchList && !Hashtable_get(this->pidMatchList, p->tgid)) )
Hisham Muhammadbfd86a62011-12-01 12:31:57 +0000287 hidden = true;
288
289 if (!hidden) {
290 Panel_set(this->panel, idx, (Object*)p);
Hisham Muhammad3383d8e2015-01-21 23:27:31 -0200291 if ((this->following == -1 && idx == currPos) || (this->following != -1 && p->pid == currPid)) {
Hisham Muhammadbfd86a62011-12-01 12:31:57 +0000292 Panel_setSelected(this->panel, idx);
293 this->panel->scrollV = currScrollV;
294 }
295 idx++;
296 }
297 }
298}
Hisham Muhammadeb229d92014-11-24 18:55:03 -0200299
Hisham Muhammadd880def2015-04-02 01:57:37 -0300300Process* ProcessList_getProcess(ProcessList* this, pid_t pid, bool* preExisting, Process_New constructor) {
Hisham Muhammad272e2d92015-03-16 23:01:48 -0300301 Process* proc = (Process*) Hashtable_get(this->processTable, pid);
302 *preExisting = proc;
303 if (proc) {
304 assert(Vector_indexOf(this->processes, proc, Process_pidCompare) != -1);
305 assert(proc->pid == pid);
306 } else {
307 proc = constructor(this->settings);
308 assert(proc->comm == NULL);
309 proc->pid = pid;
310 }
311 return proc;
312}
313
Christian Göttsche96e2a422020-10-13 16:03:37 +0200314void ProcessList_scan(ProcessList* this, bool pauseProcessUpdate) {
Adam Saponaradde71c62020-10-30 21:56:16 -0400315 struct timespec now;
Christian Göttsche96e2a422020-10-13 16:03:37 +0200316
317 // in pause mode only gather global data for meters (CPU/memory/...)
318 if (pauseProcessUpdate) {
319 ProcessList_goThroughEntries(this, true);
320 return;
321 }
Hisham Muhammad272e2d92015-03-16 23:01:48 -0300322
323 // mark all process as "dirty"
324 for (int i = 0; i < Vector_size(this->processes); i++) {
325 Process* p = (Process*) Vector_get(this->processes, i);
326 p->updated = false;
Adam Saponaraa83f5152020-10-31 20:36:53 -0400327 p->wasShown = p->show;
Hisham Muhammadc1830942016-02-18 14:32:49 -0200328 p->show = true;
Hisham Muhammad272e2d92015-03-16 23:01:48 -0300329 }
330
331 this->totalTasks = 0;
332 this->userlandThreads = 0;
333 this->kernelThreads = 0;
334 this->runningTasks = 0;
335
Adam Saponaradde71c62020-10-30 21:56:16 -0400336
337 // set scanTs
Daniel Lange8f2d1292020-11-16 12:17:28 +0100338 static bool firstScanDone = false;
339 if (!firstScanDone) {
340 this->scanTs = 0;
341 firstScanDone = true;
342 } else if (clock_gettime(CLOCK_MONOTONIC, &now) == 0) {
Adam Saponaradde71c62020-10-30 21:56:16 -0400343 this->scanTs = now.tv_sec;
344 }
345
Christian Göttsche96e2a422020-10-13 16:03:37 +0200346 ProcessList_goThroughEntries(this, false);
Daniel Flanagandd334442019-10-31 11:39:12 -0500347
Hisham Muhammad272e2d92015-03-16 23:01:48 -0300348 for (int i = Vector_size(this->processes) - 1; i >= 0; i--) {
349 Process* p = (Process*) Vector_get(this->processes, i);
Adam Saponaradde71c62020-10-30 21:56:16 -0400350 if (p->tombTs > 0) {
351 // remove tombed process
352 if (this->scanTs >= p->tombTs) {
Christian Göttsche4fb82e32020-11-20 17:50:30 +0100353 ProcessList_remove(this, p);
Adam Saponaradde71c62020-10-30 21:56:16 -0400354 }
355 } else if (p->updated == false) {
356 // process no longer exists
Adam Saponaraa83f5152020-10-31 20:36:53 -0400357 if (this->settings->highlightChanges && p->wasShown) {
Adam Saponaradde71c62020-10-30 21:56:16 -0400358 // mark tombed
359 p->tombTs = this->scanTs + this->settings->highlightDelaySecs;
360 } else {
361 // immediately remove
362 ProcessList_remove(this, p);
363 }
Benny Baumann45869512020-11-01 01:09:51 +0100364 } else {
Hisham Muhammad272e2d92015-03-16 23:01:48 -0300365 p->updated = false;
Benny Baumann45869512020-11-01 01:09:51 +0100366 }
Hisham Muhammad272e2d92015-03-16 23:01:48 -0300367 }
368}