summaryrefslogtreecommitdiffstats
path: root/linux
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2015-03-16 03:25:43 -0300
committerHisham Muhammad <hisham@gobolinux.org>2015-03-16 03:25:43 -0300
commit7fd4af80ff7828b39f67584634931e552c795e3f (patch)
tree6b2d43d0cc8cc524dd10f0177c2673fcc7db50df /linux
parent5c8b83405b5e9234ac1d820162e3c66c0e9df648 (diff)
Linux build fixes.
Diffstat (limited to 'linux')
-rw-r--r--linux/LinuxProcess.h2
-rw-r--r--linux/LinuxProcessList.c7
-rw-r--r--linux/LinuxProcessList.h10
-rw-r--r--linux/Platform.c4
4 files changed, 7 insertions, 16 deletions
diff --git a/linux/LinuxProcess.h b/linux/LinuxProcess.h
index 2db1a924..ebbddf36 100644
--- a/linux/LinuxProcess.h
+++ b/linux/LinuxProcess.h
@@ -75,7 +75,7 @@ typedef enum LinuxProcessFields {
OOM = 114,
#endif
IO_PRIORITY = 115,
- LAST_PROCESSFIELD
+ LAST_PROCESSFIELD = 116,
} LinuxProcessField;
#include "IOPriority.h"
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
index 9770ab09..82ee0ef6 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -475,6 +475,7 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, const char* dirna
}
static bool LinuxProcessList_processEntries(LinuxProcessList* this, const char* dirname, Process* parent, double period, struct timeval tv) {
+ ProcessList* pl = (ProcessList*) this;
DIR* dir;
struct dirent* entry;
Settings* settings = this->super.settings;
@@ -551,7 +552,7 @@ static bool LinuxProcessList_processEntries(LinuxProcessList* this, const char*
float percent_cpu = (lp->utime + lp->stime - lasttimes) / period * 100.0;
proc->percent_cpu = MAX(MIN(percent_cpu, cpus*100.0), 0.0);
if (isnan(proc->percent_cpu)) proc->percent_cpu = 0.0;
- proc->percent_mem = (proc->m_resident * PAGE_SIZE_KB) / (double)(this->totalMem) * 100.0;
+ proc->percent_mem = (proc->m_resident * PAGE_SIZE_KB) / (double)(pl->totalMem) * 100.0;
if(!existingProc) {
@@ -633,7 +634,7 @@ static bool LinuxProcessList_processEntries(LinuxProcessList* this, const char*
return true;
}
-static inline void LinuxProcessList_scanMemoryInfo(LinuxProcessList* this) {
+static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
unsigned long long int swapFree = 0;
FILE* file = fopen(PROCMEMINFOFILE, "r");
@@ -754,7 +755,7 @@ static inline double LinuxProcessList_scanCPUTime(LinuxProcessList* this) {
void ProcessList_scan(ProcessList* super) {
LinuxProcessList* this = (LinuxProcessList*) super;
- LinuxProcessList_scanMemoryInfo(this);
+ LinuxProcessList_scanMemoryInfo(super);
double period = LinuxProcessList_scanCPUTime(this);
diff --git a/linux/LinuxProcessList.h b/linux/LinuxProcessList.h
index cfd01828..5509bb50 100644
--- a/linux/LinuxProcessList.h
+++ b/linux/LinuxProcessList.h
@@ -50,16 +50,6 @@ typedef struct LinuxProcessList_ {
CPUData* cpus;
- unsigned long long int totalMem;
- unsigned long long int usedMem;
- unsigned long long int freeMem;
- unsigned long long int sharedMem;
- unsigned long long int buffersMem;
- unsigned long long int cachedMem;
- unsigned long long int totalSwap;
- unsigned long long int usedSwap;
- unsigned long long int freeSwap;
-
} LinuxProcessList;
#ifndef PROCDIR
diff --git a/linux/Platform.c b/linux/Platform.c
index 5ade6e9d..b480fd01 100644
--- a/linux/Platform.c
+++ b/linux/Platform.c
@@ -149,7 +149,7 @@ double Platform_setCPUValues(Meter* this, int cpu) {
}
void Platform_setMemoryValues(Meter* this) {
- LinuxProcessList* pl = (LinuxProcessList*) this->pl;
+ ProcessList* pl = (ProcessList*) this->pl;
long int usedMem = pl->usedMem;
long int buffersMem = pl->buffersMem;
long int cachedMem = pl->cachedMem;
@@ -161,7 +161,7 @@ void Platform_setMemoryValues(Meter* this) {
}
void Platform_setSwapValues(Meter* this) {
- LinuxProcessList* pl = (LinuxProcessList*) this->pl;
+ ProcessList* pl = (ProcessList*) this->pl;
this->total = pl->totalSwap;
this->values[0] = pl->usedSwap;
}

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