Build fixes.

This commit is contained in:
Hisham Muhammad 2014-11-27 16:31:42 -02:00
parent 6afacee50d
commit ff4d1b466f
1 changed files with 34 additions and 34 deletions

View File

@ -572,13 +572,12 @@ static bool LinuxProcessList_processEntries(ProcessList* this, const char* dirna
}
static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
unsigned long long int swapFree = 0;
FILE* file = fopen(PROCMEMINFOFILE, "r");
if (file == NULL) {
CRT_fatalError("Cannot open " PROCMEMINFOFILE);
}
int cpus = this->cpuCount;
assert(cpus > 0);
{
char buffer[128];
while (fgets(buffer, 128, file)) {
@ -607,18 +606,21 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
break;
}
}
}
this->usedMem = this->totalMem - this->freeMem;
this->usedSwap = this->totalSwap - swapFree;
fclose(file);
}
static inline double LinuxProcessList_readCPUTime(ProcessList* this) {
static inline double LinuxProcessList_scanCPUTime(ProcessList* this) {
unsigned long long int usertime, nicetime, systemtime, idletime;
FILE* file = fopen(PROCSTATFILE, "r");
if (file == NULL) {
CRT_fatalError("Cannot open " PROCSTATFILE);
}
int cpus = this->cpuCount;
assert(cpus > 0);
for (int i = 0; i <= cpus; i++) {
char buffer[256];
int cpuid;
@ -687,12 +689,10 @@ static inline double LinuxProcessList_readCPUTime(ProcessList* this) {
}
void ProcessList_scan(ProcessList* this) {
unsigned long long int usertime, nicetime, systemtime, idletime;
unsigned long long int swapFree = 0;
LinuxProcessList_scanMemoryInfo(this);
LinuxProcessList_scanCPUTime(this);
double period = LinuxProcessList_scanCPUTime(this);
// mark all process as "dirty"
for (int i = 0; i < Vector_size(this->processes); i++) {