mirror of https://github.com/xzeldon/htop.git
Merge branch 'hishamhm-pull-974'
This commit is contained in:
commit
ab61ae3963
|
@ -18,6 +18,7 @@ in the source distribution for its full text.
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
/*{
|
/*{
|
||||||
|
|
||||||
|
@ -444,10 +445,14 @@ void ProcessList_goThroughEntries(ProcessList* this) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
struct kinfo_proc* kprocs = kvm_getprocs(fpl->kd, KERN_PROC_PROC, 0, &count);
|
struct kinfo_proc* kprocs = kvm_getprocs(fpl->kd, KERN_PROC_PROC, 0, &count);
|
||||||
|
|
||||||
|
struct timeval tv;
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
struct kinfo_proc* kproc = &kprocs[i];
|
struct kinfo_proc* kproc = &kprocs[i];
|
||||||
bool preExisting = false;
|
bool preExisting = false;
|
||||||
bool isIdleProcess = false;
|
bool isIdleProcess = false;
|
||||||
|
struct tm date;
|
||||||
Process* proc = ProcessList_getProcess(this, kproc->ki_pid, &preExisting, (Process_New) FreeBSDProcess_new);
|
Process* proc = ProcessList_getProcess(this, kproc->ki_pid, &preExisting, (Process_New) FreeBSDProcess_new);
|
||||||
FreeBSDProcess* fp = (FreeBSDProcess*) proc;
|
FreeBSDProcess* fp = (FreeBSDProcess*) proc;
|
||||||
|
|
||||||
|
@ -538,6 +543,9 @@ void ProcessList_goThroughEntries(ProcessList* this) {
|
||||||
this->kernelThreads++;
|
this->kernelThreads++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(void) localtime_r((time_t*) &proc->starttime_ctime, &date);
|
||||||
|
strftime(proc->starttime_show, 7, ((proc->starttime_ctime > tv.tv_sec - 86400) ? "%R " : "%b%d "), &date);
|
||||||
|
|
||||||
this->totalTasks++;
|
this->totalTasks++;
|
||||||
if (proc->state == 'R')
|
if (proc->state == 'R')
|
||||||
this->runningTasks++;
|
this->runningTasks++;
|
||||||
|
|
Loading…
Reference in New Issue