summaryrefslogtreecommitdiffstats
path: root/Process.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-05-02 13:29:39 +0200
committercgzones <cgzones@googlemail.com>2021-05-23 15:43:23 +0200
commit550a1418606f487941b3dddbf81de17c459db66c (patch)
tree7e0b902b406d7858772dc8b14d65fb4cc72b8de9 /Process.c
parent3d5b6d9282e584557999772d3cedd7e8ceddabbd (diff)
Add ELAPSED process column
Add process columns showing the elapsed time since the process was started. Similar to STARTTIME, but shows the time passed since the process start instead of the fixed start time of the process. Closes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=782636
Diffstat (limited to 'Process.c')
-rw-r--r--Process.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Process.c b/Process.c
index f134be53..b2eb5a01 100644
--- a/Process.c
+++ b/Process.c
@@ -777,6 +777,7 @@ void Process_writeField(const Process* this, RichString* str, ProcessField field
Process_printLeftAlignedField(str, attr, procExe, TASK_COMM_LEN - 1);
return;
}
+ case ELAPSED: Process_printTime(str, /* convert to hundreds of a second */ this->processList->realtimeMs / 10 - 100 * this->starttime_ctime, coloring); return;
case MAJFLT: Process_printCount(str, this->majflt, coloring); return;
case MINFLT: Process_printCount(str, this->minflt, coloring); return;
case M_RESIDENT: Process_printKBytes(str, this->m_resident, coloring); return;
@@ -1073,6 +1074,9 @@ int Process_compareByKey_Base(const Process* p1, const Process* p2, ProcessField
const char *exe2 = p2->procExe ? (p2->procExe + p2->procExeBasenameOffset) : (Process_isKernelThread(p2) ? kthreadID : "");
return SPACESHIP_NULLSTR(exe1, exe2);
}
+ case ELAPSED:
+ r = -SPACESHIP_NUMBER(p1->starttime_ctime, p2->starttime_ctime);
+ return r != 0 ? r : SPACESHIP_NUMBER(p1->pid, p2->pid);
case MAJFLT:
return SPACESHIP_NUMBER(p1->majflt, p2->majflt);
case MINFLT:

© 2014-2024 Faster IT GmbH | imprint | privacy policy