mirror of https://github.com/xzeldon/htop.git
Improve OOM output
* Fix sort by adding cast * Shrink column size to 4 * Drop unnecessary maximum field width specifier in sscanf
This commit is contained in:
parent
2d14269bcd
commit
d9a5dd4b91
|
@ -264,7 +264,6 @@ ProcessPidColumn Process_pidColumns[] = {
|
||||||
{ .id = TGID, .label = "TGID" },
|
{ .id = TGID, .label = "TGID" },
|
||||||
{ .id = PGRP, .label = "PGRP" },
|
{ .id = PGRP, .label = "PGRP" },
|
||||||
{ .id = SESSION, .label = "SID" },
|
{ .id = SESSION, .label = "SID" },
|
||||||
{ .id = OOM, .label = "OOM" },
|
|
||||||
{ .id = 0, .label = NULL },
|
{ .id = 0, .label = NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -397,7 +396,7 @@ void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field)
|
||||||
#ifdef HAVE_CGROUP
|
#ifdef HAVE_CGROUP
|
||||||
case CGROUP: xSnprintf(buffer, n, "%-10s ", lp->cgroup); break;
|
case CGROUP: xSnprintf(buffer, n, "%-10s ", lp->cgroup); break;
|
||||||
#endif
|
#endif
|
||||||
case OOM: xSnprintf(buffer, n, Process_pidFormat, lp->oom); break;
|
case OOM: xSnprintf(buffer, n, "%4u ", lp->oom); break;
|
||||||
case IO_PRIORITY: {
|
case IO_PRIORITY: {
|
||||||
int klass = IOPriority_class(lp->ioPriority);
|
int klass = IOPriority_class(lp->ioPriority);
|
||||||
if (klass == IOPRIO_CLASS_NONE) {
|
if (klass == IOPRIO_CLASS_NONE) {
|
||||||
|
@ -493,7 +492,7 @@ long LinuxProcess_compare(const void* v1, const void* v2) {
|
||||||
return strcmp(p1->cgroup ? p1->cgroup : "", p2->cgroup ? p2->cgroup : "");
|
return strcmp(p1->cgroup ? p1->cgroup : "", p2->cgroup ? p2->cgroup : "");
|
||||||
#endif
|
#endif
|
||||||
case OOM:
|
case OOM:
|
||||||
return (p2->oom - p1->oom);
|
return ((long)p2->oom - (long)p1->oom);
|
||||||
#ifdef HAVE_DELAYACCT
|
#ifdef HAVE_DELAYACCT
|
||||||
case PERCENT_CPU_DELAY:
|
case PERCENT_CPU_DELAY:
|
||||||
return (p2->cpu_delay_percent > p1->cpu_delay_percent ? 1 : -1);
|
return (p2->cpu_delay_percent > p1->cpu_delay_percent ? 1 : -1);
|
||||||
|
|
|
@ -670,7 +670,7 @@ static void LinuxProcessList_readOomData(LinuxProcess* process, const char* dirn
|
||||||
char buffer[PROC_LINE_LENGTH + 1];
|
char buffer[PROC_LINE_LENGTH + 1];
|
||||||
if (fgets(buffer, PROC_LINE_LENGTH, file)) {
|
if (fgets(buffer, PROC_LINE_LENGTH, file)) {
|
||||||
unsigned int oom;
|
unsigned int oom;
|
||||||
int ok = sscanf(buffer, "%32u", &oom);
|
int ok = sscanf(buffer, "%u", &oom);
|
||||||
if (ok >= 1) {
|
if (ok >= 1) {
|
||||||
process->oom = oom;
|
process->oom = oom;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue