diff --git a/ChangeLog b/ChangeLog index 4e1c3149d30e53bcd207f39e7f68f0c57e96eec5..1aafc65d80bc95d5dbeff329fb3e24f7886557dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ What's new in version 1.0.3 of IO data depending on selected fields. * Better consistency in coloring. * Increase limit of buffer when tracing a deep nested process tree. +* Display pagefault stats. * BUGFIX: Fix crash when adding meters and toggling detailed CPU time. (thanks to Dawid Gajownik) * Add column to track the OOM-killer score of processes diff --git a/Process.c b/Process.c index efaf3f68d8a445bfdc4d5e472e73fb8ace3ea376..4efd8545841ce82a014b44c8d37d0d23f7409554 100644 --- a/Process.c +++ b/Process.c @@ -168,11 +168,11 @@ typedef struct Process_ { int basenameOffset; bool updated; - #ifdef DEBUG unsigned long int minflt; unsigned long int cminflt; unsigned long int majflt; unsigned long int cmajflt; + #ifdef DEBUG long int itrealvalue; unsigned long int vsize; long int rss; @@ -254,7 +254,7 @@ const int Process_fieldFlags[] = { const char *Process_fieldTitles[] = { "", " PID ", "Command ", "S ", " PPID ", " PGRP ", " SESN ", - " TTY ", " TPGID ", "- ", "- ", "- ", "- ", "- ", + " TTY ", " TPGID ", "- ", " MINFLT ", " CMINFLT ", " MAJFLT ", " CMAJFLT ", " UTIME+ ", " STIME+ ", " CUTIME+ ", " CSTIME+ ", "PRI ", " NI ", "- ", "START ", "- ", "- ", "- ", "- ", "- ", "- ", "- ", "- ", "- ", "- ", "- ", "- ", "- ", @@ -483,6 +483,10 @@ static void Process_writeField(Process* this, RichString* str, ProcessField fiel case TTY_NR: snprintf(buffer, n, "%5u ", this->tty_nr); break; case TGID: snprintf(buffer, n, Process_pidFormat, this->tgid); break; case TPGID: snprintf(buffer, n, Process_tpgidFormat, this->tpgid); break; + case MINFLT: Process_colorNumber(str, this->minflt, coloring); return; + case CMINFLT: Process_colorNumber(str, this->cminflt, coloring); return; + case MAJFLT: Process_colorNumber(str, this->majflt, coloring); return; + case CMAJFLT: Process_colorNumber(str, this->cmajflt, coloring); return; case PROCESSOR: snprintf(buffer, n, "%3d ", ProcessList_cpuId(this->pl, this->processor)); break; case NLWP: snprintf(buffer, n, "%4ld ", this->nlwp); break; case COMM: { diff --git a/Process.h b/Process.h index 774b50ac887a3f47039b362bfe56d6f28952c5e3..19083fde66bb81eeb45685857f3306e7d686a354 100644 --- a/Process.h +++ b/Process.h @@ -147,11 +147,11 @@ typedef struct Process_ { int basenameOffset; bool updated; - #ifdef DEBUG unsigned long int minflt; unsigned long int cminflt; unsigned long int majflt; unsigned long int cmajflt; + #ifdef DEBUG long int itrealvalue; unsigned long int vsize; long int rss; diff --git a/ProcessList.c b/ProcessList.c index 908d88fcbc1bb3db9c174dabd9f62ed33c20d973..d362115532ff1348a2557860409add334c4d4fc0 100644 --- a/ProcessList.c +++ b/ProcessList.c @@ -444,10 +444,14 @@ static bool ProcessList_readStatFile(Process *process, const char* dirname, cons location += 1; process->flags = strtoul(location, &location, 10); location += 1; - location = strchr(location, ' ')+1; - location = strchr(location, ' ')+1; - location = strchr(location, ' ')+1; - location = strchr(location, ' ')+1; + process->minflt = strtoull(location, &location, 10); + location += 1; + process->cminflt = strtoull(location, &location, 10); + location += 1; + process->majflt = strtoull(location, &location, 10); + location += 1; + process->cmajflt = strtoull(location, &location, 10); + location += 1; process->utime = strtoull(location, &location, 10); location += 1; process->stime = strtoull(location, &location, 10);