mirror of https://github.com/xzeldon/htop.git
Add support of NLWP field, by Bert Wesarg
This commit is contained in:
parent
e1a7e2bdef
commit
d357c67717
|
@ -1,5 +1,7 @@
|
||||||
What's new in version 0.6.6
|
What's new in version 0.6.6
|
||||||
|
|
||||||
|
* Add support of NLWP field
|
||||||
|
(thanks to Bert Wesarg)
|
||||||
* BUGFIX: Fix use of configurable /proc location
|
* BUGFIX: Fix use of configurable /proc location
|
||||||
(thanks to Florent Thoumie)
|
(thanks to Florent Thoumie)
|
||||||
* Fix memory percentage calculation and make it saner
|
* 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,
|
STIME, CUTIME, CSTIME, PRIORITY, NICE, ITREALVALUE, STARTTIME, VSIZE, RSS, RLIM, STARTCODE, ENDCODE,
|
||||||
STARTSTACK, KSTKESP, KSTKEIP, SIGNAL, BLOCKED, SSIGIGNORE, SIGCATCH, WCHAN, NSWAP, CNSWAP, EXIT_SIGNAL,
|
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,
|
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;
|
} ProcessField;
|
||||||
|
|
||||||
struct ProcessList_;
|
struct ProcessList_;
|
||||||
|
@ -75,6 +75,7 @@ typedef struct Process_ {
|
||||||
long int cstime;
|
long int cstime;
|
||||||
long int priority;
|
long int priority;
|
||||||
long int nice;
|
long int nice;
|
||||||
|
long int nlwp;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
long int itrealvalue;
|
long int itrealvalue;
|
||||||
unsigned long int starttime;
|
unsigned long int starttime;
|
||||||
|
@ -118,7 +119,7 @@ char* PROCESS_CLASS = "Process";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *Process_fieldNames[] = {
|
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;
|
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 TTY_NR: snprintf(buffer, n, "%5u ", this->tty_nr); break;
|
||||||
case TPGID: snprintf(buffer, n, "%5u ", this->tpgid); break;
|
case TPGID: snprintf(buffer, n, "%5u ", this->tpgid); break;
|
||||||
case PROCESSOR: snprintf(buffer, n, "%3d ", this->processor+1); break;
|
case PROCESSOR: snprintf(buffer, n, "%3d ", this->processor+1); break;
|
||||||
|
case NLWP: snprintf(buffer, n, "%4ld ", this->nlwp); break;
|
||||||
case COMM: {
|
case COMM: {
|
||||||
if (!this->pl->treeView || this->indent == 0) {
|
if (!this->pl->treeView || this->indent == 0) {
|
||||||
Process_writeCommand(this, attr, str);
|
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));
|
return ((p2->utime+p2->stime) - (p1->utime+p1->stime));
|
||||||
case COMM:
|
case COMM:
|
||||||
return strcmp(p1->comm, p2->comm);
|
return strcmp(p1->comm, p2->comm);
|
||||||
|
case NLWP:
|
||||||
|
return (p1->nlwp - p2->nlwp);
|
||||||
default:
|
default:
|
||||||
return (p1->pid - p2->pid);
|
return (p1->pid - p2->pid);
|
||||||
}
|
}
|
||||||
|
@ -456,6 +460,7 @@ char* Process_printField(ProcessField field) {
|
||||||
case PERCENT_CPU: return "CPU% ";
|
case PERCENT_CPU: return "CPU% ";
|
||||||
case PERCENT_MEM: return "MEM% ";
|
case PERCENT_MEM: return "MEM% ";
|
||||||
case PROCESSOR: return "CPU ";
|
case PROCESSOR: return "CPU ";
|
||||||
|
case NLWP: return "NLWP ";
|
||||||
default: return "- ";
|
default: return "- ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ typedef enum ProcessField_ {
|
||||||
STIME, CUTIME, CSTIME, PRIORITY, NICE, ITREALVALUE, STARTTIME, VSIZE, RSS, RLIM, STARTCODE, ENDCODE,
|
STIME, CUTIME, CSTIME, PRIORITY, NICE, ITREALVALUE, STARTTIME, VSIZE, RSS, RLIM, STARTCODE, ENDCODE,
|
||||||
STARTSTACK, KSTKESP, KSTKEIP, SIGNAL, BLOCKED, SSIGIGNORE, SIGCATCH, WCHAN, NSWAP, CNSWAP, EXIT_SIGNAL,
|
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,
|
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;
|
} ProcessField;
|
||||||
|
|
||||||
struct ProcessList_;
|
struct ProcessList_;
|
||||||
|
@ -77,6 +77,7 @@ typedef struct Process_ {
|
||||||
long int cstime;
|
long int cstime;
|
||||||
long int priority;
|
long int priority;
|
||||||
long int nice;
|
long int nice;
|
||||||
|
long int nlwp;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
long int itrealvalue;
|
long int itrealvalue;
|
||||||
unsigned long int starttime;
|
unsigned long int starttime;
|
||||||
|
|
|
@ -417,7 +417,7 @@ static int ProcessList_readStatFile(ProcessList* this, Process *proc, FILE *f, c
|
||||||
&proc->tpgid, &proc->flags,
|
&proc->tpgid, &proc->flags,
|
||||||
&proc->minflt, &proc->cminflt, &proc->majflt, &proc->cmajflt,
|
&proc->minflt, &proc->cminflt, &proc->majflt, &proc->cmajflt,
|
||||||
&proc->utime, &proc->stime, &proc->cutime, &proc->cstime,
|
&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->starttime, &proc->vsize, &proc->rss, &proc->rlim,
|
||||||
&proc->startcode, &proc->endcode, &proc->startstack, &proc->kstkesp,
|
&proc->startcode, &proc->endcode, &proc->startstack, &proc->kstkesp,
|
||||||
&proc->kstkeip, &proc->signal, &proc->blocked, &proc->sigignore,
|
&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,
|
&proc->tpgid, &proc->flags,
|
||||||
&zero, &zero, &zero, &zero,
|
&zero, &zero, &zero, &zero,
|
||||||
&proc->utime, &proc->stime, &proc->cutime, &proc->cstime,
|
&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, &uzero, &zero,
|
||||||
&zero, &zero, &zero, &zero,
|
&zero, &zero, &zero, &zero,
|
||||||
&zero, &zero, &zero, &zero,
|
&zero, &zero, &zero, &zero,
|
||||||
|
|
Loading…
Reference in New Issue