summaryrefslogtreecommitdiffstats
path: root/ProcessList.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2007-11-09 00:40:59 +0000
committerHisham Muhammad <hisham@gobolinux.org>2007-11-09 00:40:59 +0000
commit855d9eaf9abb82c4775c5be143e71c9de1cd22b3 (patch)
treee341c677065802ee5c8e7103259cb0b1eb2f5975 /ProcessList.c
parentb70b35ea659d9a859de3cb480580ceb98a6b63e0 (diff)
IO-wait time now counts as idle time, which is a more
accurate description. It is still available in split time, now called detailed CPU time. (thanks to Samuel Thibault for the report)
Diffstat (limited to 'ProcessList.c')
-rw-r--r--ProcessList.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/ProcessList.c b/ProcessList.c
index 4b22bc08..6b18e04d 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -53,7 +53,7 @@ in the source distribution for its full text.
#endif
#ifndef PER_PROCESSOR_FIELDS
-#define PER_PROCESSOR_FIELDS 20
+#define PER_PROCESSOR_FIELDS 22
#endif
}*/
@@ -80,6 +80,7 @@ typedef struct ProcessList_ {
unsigned long long int* userTime;
unsigned long long int* systemTime;
unsigned long long int* systemAllTime;
+ unsigned long long int* idleAllTime;
unsigned long long int* idleTime;
unsigned long long int* niceTime;
unsigned long long int* ioWaitTime;
@@ -90,6 +91,7 @@ typedef struct ProcessList_ {
unsigned long long int* userPeriod;
unsigned long long int* systemPeriod;
unsigned long long int* systemAllPeriod;
+ unsigned long long int* idleAllPeriod;
unsigned long long int* idlePeriod;
unsigned long long int* nicePeriod;
unsigned long long int* ioWaitPeriod;
@@ -117,7 +119,7 @@ typedef struct ProcessList_ {
bool treeView;
bool highlightBaseName;
bool highlightMegabytes;
- bool expandSystemTime;
+ bool detailedCPUTime;
#ifdef DEBUG_PROC
FILE* traceFile;
#endif
@@ -248,7 +250,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable) {
this->treeView = false;
this->highlightBaseName = false;
this->highlightMegabytes = false;
- this->expandSystemTime = false;
+ this->detailedCPUTime = false;
return this;
}
@@ -656,7 +658,7 @@ void ProcessList_processEntries(ProcessList* this, char* dirname, int parent, fl
}
void ProcessList_scan(ProcessList* this) {
- unsigned long long int usertime, nicetime, systemtime, systemalltime, idletime, totaltime;
+ unsigned long long int usertime, nicetime, systemtime, systemalltime, idlealltime, idletime, totaltime;
unsigned long long int swapFree;
FILE* status;
@@ -716,14 +718,16 @@ void ProcessList_scan(ProcessList* this) {
}
// Fields existing on kernels >= 2.6
// (and RHEL's patched kernel 2.4...)
- systemalltime = systemtime + ioWait + irq + softIrq + steal;
- totaltime = usertime + nicetime + systemalltime + idletime;
+ idlealltime = idletime + ioWait;
+ systemalltime = systemtime + irq + softIrq + steal;
+ totaltime = usertime + nicetime + systemalltime + idlealltime;
assert (usertime >= this->userTime[i]);
assert (nicetime >= this->niceTime[i]);
assert (systemtime >= this->systemTime[i]);
assert (idletime >= this->idleTime[i]);
assert (totaltime >= this->totalTime[i]);
assert (systemalltime >= this->systemAllTime[i]);
+ assert (idlealltime >= this->idleAllTime[i]);
assert (ioWait >= this->ioWaitTime[i]);
assert (irq >= this->irqTime[i]);
assert (softIrq >= this->softIrqTime[i]);
@@ -732,6 +736,7 @@ void ProcessList_scan(ProcessList* this) {
this->nicePeriod[i] = nicetime - this->niceTime[i];
this->systemPeriod[i] = systemtime - this->systemTime[i];
this->systemAllPeriod[i] = systemalltime - this->systemAllTime[i];
+ this->idleAllPeriod[i] = idlealltime - this->idleAllTime[i];
this->idlePeriod[i] = idletime - this->idleTime[i];
this->ioWaitPeriod[i] = ioWait - this->ioWaitTime[i];
this->irqPeriod[i] = irq - this->irqTime[i];
@@ -742,6 +747,7 @@ void ProcessList_scan(ProcessList* this) {
this->niceTime[i] = nicetime;
this->systemTime[i] = systemtime;
this->systemAllTime[i] = systemalltime;
+ this->idleAllTime[i] = idlealltime;
this->idleTime[i] = idletime;
this->ioWaitTime[i] = ioWait;
this->irqTime[i] = irq;