Commit d357c677 authored by Hisham Muhammad's avatar Hisham Muhammad
Browse files

Add support of NLWP field, by Bert Wesarg

parent e1a7e2bd
What's new in version 0.6.6
* Add support of NLWP field
(thanks to Bert Wesarg)
* BUGFIX: Fix use of configurable /proc location
(thanks to Florent Thoumie)
* Fix memory percentage calculation and make it saner
......
......@@ -41,7 +41,7 @@ typedef enum ProcessField_ {
STIME, CUTIME, CSTIME, PRIORITY, NICE, ITREALVALUE, STARTTIME, VSIZE, RSS, RLIM, STARTCODE, ENDCODE,
STARTSTACK, KSTKESP, KSTKEIP, SIGNAL, BLOCKED, SSIGIGNORE, SIGCATCH, WCHAN, NSWAP, CNSWAP, EXIT_SIGNAL,
PROCESSOR, M_SIZE, M_RESIDENT, M_SHARE, M_TRS, M_DRS, M_LRS, M_DT, ST_UID, PERCENT_CPU, PERCENT_MEM,
USER, TIME, LAST_PROCESSFIELD
USER, TIME, NLWP, LAST_PROCESSFIELD
} ProcessField;
struct ProcessList_;
......@@ -75,6 +75,7 @@ typedef struct Process_ {
long int cstime;
long int priority;
long int nice;
long int nlwp;
#ifdef DEBUG
long int itrealvalue;
unsigned long int starttime;
......@@ -118,7 +119,7 @@ char* PROCESS_CLASS = "Process";
#endif
char *Process_fieldNames[] = {
"", "PID", "Command", "STATE", "PPID", "PGRP", "SESSION", "TTY_NR", "TPGID", "FLAGS", "MINFLT", "CMINFLT", "MAJFLT", "CMAJFLT", "UTIME", "STIME", "CUTIME", "CSTIME", "PRIORITY", "NICE", "ITREALVALUE", "STARTTIME", "VSIZE", "RSS", "RLIM", "STARTCODE", "ENDCODE", "STARTSTACK", "KSTKESP", "KSTKEIP", "SIGNAL", "BLOCKED", "SIGIGNORE", "SIGCATCH", "WCHAN", "NSWAP", "CNSWAP", "EXIT_SIGNAL", "PROCESSOR", "M_SIZE", "M_RESIDENT", "M_SHARE", "M_TRS", "M_DRS", "M_LRS", "M_DT", "ST_UID", "PERCENT_CPU", "PERCENT_MEM", "USER", "TIME", "*** report bug! ***"
"", "PID", "Command", "STATE", "PPID", "PGRP", "SESSION", "TTY_NR", "TPGID", "FLAGS", "MINFLT", "CMINFLT", "MAJFLT", "CMAJFLT", "UTIME", "STIME", "CUTIME", "CSTIME", "PRIORITY", "NICE", "ITREALVALUE", "STARTTIME", "VSIZE", "RSS", "RLIM", "STARTCODE", "ENDCODE", "STARTSTACK", "KSTKESP", "KSTKEIP", "SIGNAL", "BLOCKED", "SIGIGNORE", "SIGCATCH", "WCHAN", "NSWAP", "CNSWAP", "EXIT_SIGNAL", "PROCESSOR", "M_SIZE", "M_RESIDENT", "M_SHARE", "M_TRS", "M_DRS", "M_LRS", "M_DT", "ST_UID", "PERCENT_CPU", "PERCENT_MEM", "USER", "TIME", "NLWP", "*** report bug! ***"
};
static int Process_getuid = -1;
......@@ -270,6 +271,7 @@ void Process_writeField(Process* this, RichString* str, ProcessField field) {
case TTY_NR: snprintf(buffer, n, "%5u ", this->tty_nr); break;
case TPGID: snprintf(buffer, n, "%5u ", this->tpgid); break;
case PROCESSOR: snprintf(buffer, n, "%3d ", this->processor+1); break;
case NLWP: snprintf(buffer, n, "%4ld ", this->nlwp); break;
case COMM: {
if (!this->pl->treeView || this->indent == 0) {
Process_writeCommand(this, attr, str);
......@@ -423,6 +425,8 @@ int Process_compare(const void* v1, const void* v2) {
return ((p2->utime+p2->stime) - (p1->utime+p1->stime));
case COMM:
return strcmp(p1->comm, p2->comm);
case NLWP:
return (p1->nlwp - p2->nlwp);
default:
return (p1->pid - p2->pid);
}
......@@ -456,6 +460,7 @@ char* Process_printField(ProcessField field) {
case PERCENT_CPU: return "CPU% ";
case PERCENT_MEM: return "MEM% ";
case PROCESSOR: return "CPU ";
case NLWP: return "NLWP ";
default: return "- ";
}
}
......@@ -43,7 +43,7 @@ typedef enum ProcessField_ {
STIME, CUTIME, CSTIME, PRIORITY, NICE, ITREALVALUE, STARTTIME, VSIZE, RSS, RLIM, STARTCODE, ENDCODE,
STARTSTACK, KSTKESP, KSTKEIP, SIGNAL, BLOCKED, SSIGIGNORE, SIGCATCH, WCHAN, NSWAP, CNSWAP, EXIT_SIGNAL,
PROCESSOR, M_SIZE, M_RESIDENT, M_SHARE, M_TRS, M_DRS, M_LRS, M_DT, ST_UID, PERCENT_CPU, PERCENT_MEM,
USER, TIME, LAST_PROCESSFIELD
USER, TIME, NLWP, LAST_PROCESSFIELD
} ProcessField;
struct ProcessList_;
......@@ -77,6 +77,7 @@ typedef struct Process_ {
long int cstime;
long int priority;
long int nice;
long int nlwp;
#ifdef DEBUG
long int itrealvalue;
unsigned long int starttime;
......
......@@ -417,7 +417,7 @@ static int ProcessList_readStatFile(ProcessList* this, Process *proc, FILE *f, c
&proc->tpgid, &proc->flags,
&proc->minflt, &proc->cminflt, &proc->majflt, &proc->cmajflt,
&proc->utime, &proc->stime, &proc->cutime, &proc->cstime,
&proc->priority, &proc->nice, &zero, &proc->itrealvalue,
&proc->priority, &proc->nice, &proc->nlwp, &proc->itrealvalue,
&proc->starttime, &proc->vsize, &proc->rss, &proc->rlim,
&proc->startcode, &proc->endcode, &proc->startstack, &proc->kstkesp,
&proc->kstkeip, &proc->signal, &proc->blocked, &proc->sigignore,
......@@ -435,7 +435,7 @@ static int ProcessList_readStatFile(ProcessList* this, Process *proc, FILE *f, c
&proc->tpgid, &proc->flags,
&zero, &zero, &zero, &zero,
&proc->utime, &proc->stime, &proc->cutime, &proc->cstime,
&proc->priority, &proc->nice, &uzero, &uzero,
&proc->priority, &proc->nice, &proc->nlwp, &uzero,
&zero, &zero, &uzero, &zero,
&zero, &zero, &zero, &zero,
&zero, &zero, &zero, &zero,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment