summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2007-05-21 19:10:53 +0000
committerHisham Muhammad <hisham@gobolinux.org>2007-05-21 19:10:53 +0000
commitd357c677178f173575ac09d70f84a3e0c19e4329 (patch)
tree14b2d9a69a87282a7add5286433bc53886c9337c
parente1a7e2bdefa24a6b1400c65f9e638881c7502900 (diff)
Add support of NLWP field, by Bert Wesarg
-rw-r--r--ChangeLog2
-rw-r--r--Process.c9
-rw-r--r--Process.h3
-rw-r--r--ProcessList.c4
4 files changed, 13 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 51e65f5d..3ed1be0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
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
diff --git a/Process.c b/Process.c
index 9bbd569e..e9d05dbe 100644
--- a/Process.c
+++ b/Process.c
@@ -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 "- ";
}
}
diff --git a/Process.h b/Process.h
index 618fa2ae..79ccc5ee 100644
--- a/Process.h
+++ b/Process.h
@@ -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;
diff --git a/ProcessList.c b/ProcessList.c
index 21cd57ed..0b02d6aa 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -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,

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