misc
This commit is contained in:
parent
9da12ae628
commit
85fc8beb41
@ -52,7 +52,6 @@ separate CPUs, but could easily be changed.
|
|||||||
//#define PRETENDNOCAP /* use a terminal without essential caps */
|
//#define PRETENDNOCAP /* use a terminal without essential caps */
|
||||||
//#define SORT_SUPRESS /* *attempt* to reduce qsort overhead */
|
//#define SORT_SUPRESS /* *attempt* to reduce qsort overhead */
|
||||||
//#define USE_LIB_STA3 /* use lib status (3 ch) vs. proc_t (1 ch) */
|
//#define USE_LIB_STA3 /* use lib status (3 ch) vs. proc_t (1 ch) */
|
||||||
//#define YIELDCPU_OFF /* hang on tight, DON'T issue sched_yield */
|
|
||||||
//#define WARN_NOT_SMP /* restrict '1' & 'I' commands to true smp */
|
//#define WARN_NOT_SMP /* restrict '1' & 'I' commands to true smp */
|
||||||
|
|
||||||
|
|
||||||
|
42
top.1
42
top.1
@ -185,11 +185,11 @@ Even so, items shown with an \*(AS could be overridden through the
|
|||||||
command-line.
|
command-line.
|
||||||
|
|
||||||
\fIGlobal_defaults\fR
|
\fIGlobal_defaults\fR
|
||||||
'A' - Alt display \fBOff\fR (full-screen)
|
'A' - Alt display Off (full-screen)
|
||||||
* 'd' - Delay time 3.0 seconds
|
* 'd' - Delay time 3.0 seconds
|
||||||
'I' - Irix mode On\ \ (no, 'solaris' smp)
|
'I' - Irix mode On\ \ (no, 'solaris' smp)
|
||||||
* 'p' - PID monitoring \fBOff\fR
|
* 'p' - PID monitoring Off
|
||||||
* 's' - Secure mode \fBOff\fR (unsecured)
|
* 's' - Secure mode Off (unsecured)
|
||||||
\fISummary_Area_defaults\fR
|
\fISummary_Area_defaults\fR
|
||||||
'l' - Load Avg/Uptime On\ \ (thus program name)
|
'l' - Load Avg/Uptime On\ \ (thus program name)
|
||||||
't' - Task/Cpu state On\ \ (1+1 lines, see '1')
|
't' - Task/Cpu state On\ \ (1+1 lines, see '1')
|
||||||
@ -197,13 +197,13 @@ command-line.
|
|||||||
'1' - Single Cpu On\ \ (thus 1 line if smp)
|
'1' - Single Cpu On\ \ (thus 1 line if smp)
|
||||||
\fITask_Area_defaults\fR
|
\fITask_Area_defaults\fR
|
||||||
'b' - Bold hilite On\ \ (not 'reverse')
|
'b' - Bold hilite On\ \ (not 'reverse')
|
||||||
* 'c' - Command line \fBOff\fR (name, not cmdline)
|
* 'c' - Command line Off (name, not cmdline)
|
||||||
* 'i' - Idle tasks On\ \ (show all tasks)
|
* 'i' - Idle tasks On\ \ (show all tasks)
|
||||||
'R' - Reverse sort On\ \ (sort pids high-to-low)
|
'R' - Reverse sort On\ \ (sort pids high-to-low)
|
||||||
* 'S' - Cumulative time \fBOff\fR (exclude dead children)
|
* 'S' - Cumulative time Off (exclude dead children)
|
||||||
'x' - Column hilite \fBOff\fR\ (no, sort field)
|
'x' - Column hilite Off\ (no, sort field)
|
||||||
'y' - Row hilite On\ \ (yes, running tasks)
|
'y' - Row hilite On\ \ (yes, running tasks)
|
||||||
'z' - color/mono \fBOff\fR\ (no, colors)
|
'z' - color/mono Off\ (no, colors)
|
||||||
|
|
||||||
|
|
||||||
.\" ----------------------------------------------------------------------
|
.\" ----------------------------------------------------------------------
|
||||||
@ -876,7 +876,7 @@ in all four windows before returning to the \*(Me display.
|
|||||||
<Enter> :apply and exit
|
<Enter> :apply and exit
|
||||||
'q' :abandon current changes and exit
|
'q' :abandon current changes and exit
|
||||||
|
|
||||||
\*(NT If your use 'a' or 'w' to cycle the targeted window, you will
|
If your use 'a' or 'w' to cycle the targeted window, you will
|
||||||
have applied the color scheme that was displayed when you left that window.
|
have applied the color scheme that was displayed when you left that window.
|
||||||
You can, of course, easily return to any window and reapply different
|
You can, of course, easily return to any window and reapply different
|
||||||
colors or turn colors \*F completely with the 'z' toggle.
|
colors or turn colors \*F completely with the 'z' toggle.
|
||||||
@ -898,7 +898,6 @@ as you return to the \*(Me display.
|
|||||||
In \*(FM there is a single window represented by the entire screen.
|
In \*(FM there is a single window represented by the entire screen.
|
||||||
That single window can still be changed to display 1 of 4 different\fB field
|
That single window can still be changed to display 1 of 4 different\fB field
|
||||||
groups\fR (\*(Xc 'G' \*(CI, repeated below).
|
groups\fR (\*(Xc 'G' \*(CI, repeated below).
|
||||||
|
|
||||||
Each of the 4 field groups has a unique separately configurable\fB \*(SA\fR
|
Each of the 4 field groups has a unique separately configurable\fB \*(SA\fR
|
||||||
and its own configurable\fB \*(TA\fR.
|
and its own configurable\fB \*(TA\fR.
|
||||||
|
|
||||||
@ -927,13 +926,13 @@ know what window is the \*(CW.
|
|||||||
.SS 4b. COMMANDS for Windows
|
.SS 4b. COMMANDS for Windows
|
||||||
.TP 7
|
.TP 7
|
||||||
\ \ \'\fB-\fR\' and \'\fB_\fR\' :\fIShow/Hide_Window(s)_toggles\fR
|
\ \ \'\fB-\fR\' and \'\fB_\fR\' :\fIShow/Hide_Window(s)_toggles\fR
|
||||||
The '-' (minus) key turns the \*(CW's \*(TD \*O and \*F.
|
The '-' key turns the \*(CW's \*(TD \*O and \*F.
|
||||||
When \*O, that \*(TA will show a minimum of the columns header you've
|
When \*O, that \*(TA will show a minimum of the columns header you've
|
||||||
established with the 'f' and 'o' commands.
|
established with the 'f' and 'o' commands.
|
||||||
It will also reflect any other \*(TA options/toggles you've applied yielding
|
It will also reflect any other \*(TA options/toggles you've applied yielding
|
||||||
zero or more tasks.
|
zero or more tasks.
|
||||||
|
|
||||||
The '_' (upper case minus) key does the same for all \*(TDs.
|
The '_' key does the same for all \*(TDs.
|
||||||
In other words, it switches between the currently visible \*(TD(s) and any
|
In other words, it switches between the currently visible \*(TD(s) and any
|
||||||
\*(TD(s) you had toggled \*F.
|
\*(TD(s) you had toggled \*F.
|
||||||
If all 4 \*(TDs are currently visible, this \*(CI will leave the \*(SA
|
If all 4 \*(TDs are currently visible, this \*(CI will leave the \*(SA
|
||||||
@ -941,11 +940,11 @@ as the only display element.
|
|||||||
|
|
||||||
.TP 7
|
.TP 7
|
||||||
*\ \'\fB=\fR\' and \'\fB+\fR\' :\fIEqualize_(re-balance)_Window(s)\fR
|
*\ \'\fB=\fR\' and \'\fB+\fR\' :\fIEqualize_(re-balance)_Window(s)\fR
|
||||||
The '=' (equals) key forces the \*(CW's \*(TD to be visible.
|
The '=' key forces the \*(CW's \*(TD to be visible.
|
||||||
It also reverses any 'i' (idle tasks) and 'n' (max tasks) commands that might
|
It also reverses any 'i' (idle tasks) and 'n' (max tasks) commands that might
|
||||||
be active.
|
be active.
|
||||||
|
|
||||||
The \'+' (upper case equals) key does the same for all windows.
|
The '+' key does the same for all windows.
|
||||||
The four \*(TDs will reappear, nice and even. They will also have retained
|
The four \*(TDs will reappear, nice and even. They will also have retained
|
||||||
any customizations you had previously applied, except for the 'i'
|
any customizations you had previously applied, except for the 'i'
|
||||||
(idle tasks) and 'n' (max tasks) commands.
|
(idle tasks) and 'n' (max tasks) commands.
|
||||||
@ -1016,8 +1015,8 @@ Here is an example of the contents of\fI /etc/toprc\fR:
|
|||||||
|
|
||||||
.\" ......................................................................
|
.\" ......................................................................
|
||||||
.SS 5b. PERSONAL Configuration File
|
.SS 5b. PERSONAL Configuration File
|
||||||
This file, written as '$HOME/.your-name-4-top' + 'rc'.
|
This file is written as '$HOME/.your-name-4-top' + 'rc'.
|
||||||
You use the 'W' \*(CI to create it or update it.
|
Use the 'W' \*(CI to create it or update it.
|
||||||
|
|
||||||
Here is the general layout:
|
Here is the general layout:
|
||||||
global # line 1: the program name/alias notation
|
global # line 1: the program name/alias notation
|
||||||
@ -1078,22 +1077,19 @@ For these stupid tricks, \*(Me needs \*(AM.
|
|||||||
|
|
||||||
.New
|
.New
|
||||||
With 3 or 4 \*(TDs visible, pick any window other than the last
|
With 3 or 4 \*(TDs visible, pick any window other than the last
|
||||||
and turn idle processes \*F.
|
and turn idle processes \*F.
|
||||||
|
|
||||||
Depending on where you applied 'i', sometimes several \*(TDs are bouncing and
|
Depending on where you applied 'i', sometimes several \*(TDs are bouncing and
|
||||||
sometimes it's like an accordion, as \*(Me tries his best to allocate space.
|
sometimes it's like an accordion, as \*(Me tries his best to allocate space.
|
||||||
|
|
||||||
.New
|
.New
|
||||||
Set each window's summary lines differently: one with no memory; another with
|
Set each window's summary lines differently: one with no memory; another with
|
||||||
no states; maybe one with nothing at all, just the message line.
|
no states; maybe one with nothing at all, just the message line.
|
||||||
|
Then hold down 'a' or 'w' and watch a variation on bouncing windows \*(EM
|
||||||
Then hold down 'a' or 'w' and watch a variation on bouncing windows.
|
hopping windows.
|
||||||
What say we call these 'hopping windows'.
|
|
||||||
|
|
||||||
.New
|
.New
|
||||||
Display all 4 windows and for each, in turn, set idle processes to \*F.
|
Display all 4 windows and for each, in turn, set idle processes to \*F.
|
||||||
|
You've just entered the "extreme bounce" zone.
|
||||||
You've just entered the "extreme bounce" zone.
|
|
||||||
|
|
||||||
.\" ......................................................................
|
.\" ......................................................................
|
||||||
.SS 6c. The Big Bird Window
|
.SS 6c. The Big Bird Window
|
||||||
|
133
top.c
133
top.c
@ -23,9 +23,6 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <curses.h>
|
#include <curses.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#ifndef YIELDCPU_OFF
|
|
||||||
#include <sched.h>
|
|
||||||
#endif
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -1147,20 +1144,23 @@ static void whack_terminal (void)
|
|||||||
/*###### Field Selection/Ordering routines #############################*/
|
/*###### Field Selection/Ordering routines #############################*/
|
||||||
|
|
||||||
/* These are our gosh darn 'Fields' !
|
/* These are our gosh darn 'Fields' !
|
||||||
They MUST be kept in sync with pflags !! */
|
They MUST be kept in sync with pflags !!
|
||||||
|
note: for integer data, the length modifiers found in .fmts may be
|
||||||
|
smaller than the true length found in the proc_t -- this plus
|
||||||
|
a cast in show_a_task provides some width protection. */
|
||||||
static FTAB_t Fieldstab[] = {
|
static FTAB_t Fieldstab[] = {
|
||||||
/* head fmts width scale sort desc
|
/* head fmts width scale sort desc
|
||||||
----------- ------- ------ ----- -------- ---------------------- */
|
----------- ------- ------ ----- -------- ---------------------- */
|
||||||
{ " PID ", "%5d ", -1, -1, _SF(P_PID), "Process Id" },
|
{ " PID ", "%5u ", -1, -1, _SF(P_PID), "Process Id" },
|
||||||
{ " PPID ", "%5d ", -1, -1, _SF(P_PPD), "Parent Process Pid" },
|
{ " PPID ", "%5u ", -1, -1, _SF(P_PPD), "Parent Process Pid" },
|
||||||
{ " PGID ", "%5d ", -1, -1, _SF(P_PGD), "Process Group Id" },
|
{ " PGID ", "%5u ", -1, -1, _SF(P_PGD), "Process Group Id" },
|
||||||
{ " UID ", "%4d ", -1, -1, _SF(P_UID), "User Id" },
|
{ " UID ", "%4u ", -1, -1, _SF(P_UID), "User Id" },
|
||||||
{ "USER ", "%-8.8s ", -1, -1, _SF(P_USR), "User Name" },
|
{ "USER ", "%-8.8s ", -1, -1, _SF(P_USR), "User Name" },
|
||||||
{ "GROUP ", "%-8.8s ", -1, -1, _SF(P_GRP), "Group Name" },
|
{ "GROUP ", "%-8.8s ", -1, -1, _SF(P_GRP), "Group Name" },
|
||||||
{ "TTY ", "%-8.8s ", 8, -1, _SF(P_TTY), "Controlling Tty" },
|
{ "TTY ", "%-8.8s ", 8, -1, _SF(P_TTY), "Controlling Tty" },
|
||||||
{ " PR ", "%3ld ", -1, -1, _SF(P_PRI), "Priority" },
|
{ " PR ", "%3d ", -1, -1, _SF(P_PRI), "Priority" },
|
||||||
{ " NI ", "%3ld ", -1, -1, _SF(P_NCE), "Nice value" },
|
{ " NI ", "%3d ", -1, -1, _SF(P_NCE), "Nice value" },
|
||||||
{ "#C ", "%2d ", -1, -1, _SF(P_CPN), "Last used cpu (SMP)" },
|
{ "#C ", "%2u ", -1, -1, _SF(P_CPN), "Last used cpu (SMP)" },
|
||||||
{ "%CPU ", "%#4.1f ", -1, -1, _SF(P_CPU), "CPU usage" },
|
{ "%CPU ", "%#4.1f ", -1, -1, _SF(P_CPU), "CPU usage" },
|
||||||
{ " TIME ", "%6.6s ", 6, -1, _SF(P_TME), "CPU Time" },
|
{ " TIME ", "%6.6s ", 6, -1, _SF(P_TME), "CPU Time" },
|
||||||
{ " TIME+ ", "%9.9s ", 9, -1, _SF(P_TME), "CPU Time, hundredths" },
|
{ " TIME+ ", "%9.9s ", 9, -1, _SF(P_TME), "CPU Time, hundredths" },
|
||||||
@ -1848,24 +1848,24 @@ static void frame_storage (void)
|
|||||||
/*
|
/*
|
||||||
* Task display *Helper* function to handle highlighted
|
* Task display *Helper* function to handle highlighted
|
||||||
* column transitions. */
|
* column transitions. */
|
||||||
static void mkcol (WIN_t *q, PFLG_t idx, int sta, int *pad, char *buf, ...)
|
static void mkcol (WIN_t *q, int a, int c, int *p, char *b, const char *f, ...)
|
||||||
{
|
{ /* a = status, c = hicol, p = pad, b = buf, f = fmt */
|
||||||
char tmp[COLBUFSIZ];
|
char tmp[COLBUFSIZ];
|
||||||
va_list va;
|
va_list va;
|
||||||
|
|
||||||
va_start(va, buf);
|
va_start(va, f);
|
||||||
/* this conditional is for piece-of-mind only, it should NOT be needed
|
/* this conditional is for piece-of-mind only, it should NOT be needed
|
||||||
given the macro employed by show_a_task (which calls us only when
|
given the macro employed by show_a_task (which calls us only when
|
||||||
the target column is the current sort field and Show_HICOLS is on) */
|
the target column is the current sort field and Show_HICOLS is on) */
|
||||||
if (!CHKw(q, Show_HICOLS) || q->sortindx != idx) {
|
if (!c) {
|
||||||
vsprintf(buf, Fieldstab[idx].fmts, va);
|
vsprintf(b, f, va);
|
||||||
} else {
|
} else {
|
||||||
vsnprintf(tmp, sizeof(tmp), Fieldstab[idx].fmts, va);
|
vsnprintf(tmp, sizeof(tmp), f, va);
|
||||||
sprintf(buf, "%s%s", q->capclr_rowhigh, tmp);
|
sprintf(b, "%s%s", q->capclr_rowhigh, tmp);
|
||||||
*pad += q->len_rowhigh;
|
*p += q->len_rowhigh;
|
||||||
if (!CHKw(q, Show_HIROWS) || 'R' != sta) {
|
if (!CHKw(q, Show_HIROWS) || 'R' != a) {
|
||||||
strcat(buf, q->capclr_rownorm);
|
strcat(b, q->capclr_rownorm);
|
||||||
*pad += q->len_rownorm;
|
*p += q->len_rownorm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
va_end(va);
|
va_end(va);
|
||||||
@ -1878,10 +1878,10 @@ static void show_a_task (WIN_t *q, proc_t *task)
|
|||||||
{
|
{
|
||||||
/* the following macro is our means to 'inline' emitting a column -- that's
|
/* the following macro is our means to 'inline' emitting a column -- that's
|
||||||
far and away the most frequent and costly part of top's entire job! */
|
far and away the most frequent and costly part of top's entire job! */
|
||||||
#define MKCOL(q,idx,sta,pad,buf,arg...) do{ \
|
#define MKCOL(q,a,c,p,b,f,v...) do{ \
|
||||||
if (!b) \
|
if (!c) \
|
||||||
snprintf(buf, sizeof(buf), f, ## arg); \
|
snprintf(b, sizeof(b), f, ## v); \
|
||||||
else mkcol(q, idx, sta, pad, buf, ## arg); }while(0)
|
else mkcol(q, a, c, p, b, f, ## v); } while(0)
|
||||||
|
|
||||||
char rbuf[ROWBUFSIZ];
|
char rbuf[ROWBUFSIZ];
|
||||||
int j, x, pad;
|
int j, x, pad;
|
||||||
@ -1895,10 +1895,10 @@ static void show_a_task (WIN_t *q, proc_t *task)
|
|||||||
char cbuf[COLBUFSIZ];
|
char cbuf[COLBUFSIZ];
|
||||||
char a = task->state; /* we'll use local var's so */
|
char a = task->state; /* we'll use local var's so */
|
||||||
PFLG_t i = q->procflags[x]; /* gcc doesn't reinvent the */
|
PFLG_t i = q->procflags[x]; /* gcc doesn't reinvent the */
|
||||||
unsigned s = Fieldstab[i].scale; /* wheel -- yields a cryptic */
|
const char *f = Fieldstab[i].fmts; /* wheel - yields a cryptic */
|
||||||
unsigned w = Fieldstab[i].width; /* mkcol, but saves +1k code */
|
unsigned s = Fieldstab[i].scale; /* mkcol, but saves a bunch */
|
||||||
const char *f = Fieldstab[i].fmts; /* (this & next macro only) */
|
unsigned w = Fieldstab[i].width; /* of generated code... */
|
||||||
int b = (CHKw(q, Show_HICOLS) && q->sortindx == i);
|
int c = (CHKw(q, Show_HICOLS) && q->sortindx == i);
|
||||||
|
|
||||||
cbuf[0] = '\0';
|
cbuf[0] = '\0';
|
||||||
switch (i) {
|
switch (i) {
|
||||||
@ -1930,76 +1930,76 @@ static void show_a_task (WIN_t *q, proc_t *task)
|
|||||||
}
|
}
|
||||||
cmdptr = cmdnam;
|
cmdptr = cmdnam;
|
||||||
}
|
}
|
||||||
MKCOL(q, i, a, &pad, cbuf, q->maxcmdln, q->maxcmdln, cmdptr);
|
MKCOL(q, a, c, &pad, cbuf, f, q->maxcmdln, q->maxcmdln, cmdptr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case P_COD:
|
case P_COD:
|
||||||
MKCOL(q, i, a, &pad, cbuf, scale_num(PAGES_2K(task->trs), w, s));
|
MKCOL(q, a, c, &pad, cbuf, f, scale_num(PAGES_2K(task->trs), w, s));
|
||||||
break;
|
break;
|
||||||
case P_CPN:
|
case P_CPN:
|
||||||
MKCOL(q, i, a, &pad, cbuf, task->processor);
|
MKCOL(q, a, c, &pad, cbuf, f, (unsigned)task->processor);
|
||||||
break;
|
break;
|
||||||
case P_CPU:
|
case P_CPU:
|
||||||
{ float u = (float)task->pcpu * Frame_tscale;
|
{ float u = (float)task->pcpu * Frame_tscale;
|
||||||
|
|
||||||
if (99.9 < u) u = 99.9;
|
if (99.9 < u) u = 99.9;
|
||||||
MKCOL(q, i, a, &pad, cbuf, u);
|
MKCOL(q, a, c, &pad, cbuf, f, u);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case P_DAT:
|
case P_DAT:
|
||||||
MKCOL(q, i, a, &pad, cbuf, scale_num(PAGES_2K(task->drs), w, s));
|
MKCOL(q, a, c, &pad, cbuf, f, scale_num(PAGES_2K(task->drs), w, s));
|
||||||
break;
|
break;
|
||||||
case P_DRT:
|
case P_DRT:
|
||||||
MKCOL(q, i, a, &pad, cbuf, scale_num((unsigned)task->dt, w, s));
|
MKCOL(q, a, c, &pad, cbuf, f, scale_num((unsigned)task->dt, w, s));
|
||||||
break;
|
break;
|
||||||
case P_FLG:
|
case P_FLG:
|
||||||
MKCOL(q, i, a, &pad, cbuf, (long)task->flags);
|
MKCOL(q, a, c, &pad, cbuf, f, (long)task->flags);
|
||||||
for (j = 0; cbuf[j]; j++)
|
for (j = 0; cbuf[j]; j++)
|
||||||
if ('0' == cbuf[j]) cbuf[j] = '.';
|
if ('0' == cbuf[j]) cbuf[j] = '.';
|
||||||
break;
|
break;
|
||||||
case P_FLT:
|
case P_FLT:
|
||||||
MKCOL(q, i, a, &pad, cbuf, scale_num(task->maj_flt, w, s));
|
MKCOL(q, a, c, &pad, cbuf, f, scale_num(task->maj_flt, w, s));
|
||||||
break;
|
break;
|
||||||
case P_GRP:
|
case P_GRP:
|
||||||
MKCOL(q, i, a, &pad, cbuf, task->egroup);
|
MKCOL(q, a, c, &pad, cbuf, f, task->egroup);
|
||||||
break;
|
break;
|
||||||
case P_MEM:
|
case P_MEM:
|
||||||
MKCOL(q, i, a, &pad, cbuf
|
MKCOL(q, a, c, &pad, cbuf, f
|
||||||
, (float)PAGES_2K(task->resident) * 100 / kb_main_total);
|
, (float)PAGES_2K(task->resident) * 100 / kb_main_total);
|
||||||
break;
|
break;
|
||||||
case P_NCE:
|
case P_NCE:
|
||||||
MKCOL(q, i, a, &pad, cbuf, (long)task->nice);
|
MKCOL(q, a, c, &pad, cbuf, f, (int)task->nice);
|
||||||
break;
|
break;
|
||||||
case P_PGD:
|
case P_PGD:
|
||||||
MKCOL(q, i, a, &pad, cbuf, task->pgrp);
|
MKCOL(q, a, c, &pad, cbuf, f, (unsigned)task->pgrp);
|
||||||
break;
|
break;
|
||||||
case P_PID:
|
case P_PID:
|
||||||
MKCOL(q, i, a, &pad, cbuf, task->pid);
|
MKCOL(q, a, c, &pad, cbuf, f, (unsigned)task->pid);
|
||||||
break;
|
break;
|
||||||
case P_PPD:
|
case P_PPD:
|
||||||
MKCOL(q, i, a, &pad, cbuf, task->ppid);
|
MKCOL(q, a, c, &pad, cbuf, f, (unsigned)task->ppid);
|
||||||
break;
|
break;
|
||||||
case P_PRI:
|
case P_PRI:
|
||||||
/* quick & dirty response to 2.5.xx RT priority */
|
if (-99 > task->priority || +99 < task->priority)
|
||||||
if (-99 > task->priority) task->priority = -99;
|
MKCOL(q, a, c, &pad, cbuf, " RT ");
|
||||||
else if (+99 < task->priority) task->priority = +99;
|
else
|
||||||
MKCOL(q, i, a, &pad, cbuf, (long)task->priority);
|
MKCOL(q, a, c, &pad, cbuf, f, (int)task->priority);
|
||||||
break;
|
break;
|
||||||
case P_RES:
|
case P_RES:
|
||||||
MKCOL(q, i, a, &pad, cbuf, scale_num(PAGES_2K(task->resident), w, s));
|
MKCOL(q, a, c, &pad, cbuf, f, scale_num(PAGES_2K(task->resident), w, s));
|
||||||
break;
|
break;
|
||||||
case P_SHR:
|
case P_SHR:
|
||||||
MKCOL(q, i, a, &pad, cbuf, scale_num(PAGES_2K(task->share), w, s));
|
MKCOL(q, a, c, &pad, cbuf, f, scale_num(PAGES_2K(task->share), w, s));
|
||||||
break;
|
break;
|
||||||
case P_STA:
|
case P_STA:
|
||||||
#ifdef USE_LIB_STA3
|
#ifdef USE_LIB_STA3
|
||||||
MKCOL(q, i, a, &pad, cbuf, status(task));
|
MKCOL(q, a, c, &pad, cbuf, f, status(task));
|
||||||
#else
|
#else
|
||||||
MKCOL(q, i, a, &pad, cbuf, task->state);
|
MKCOL(q, a, c, &pad, cbuf, f, task->state);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case P_SWP:
|
case P_SWP:
|
||||||
MKCOL(q, i, a, &pad, cbuf
|
MKCOL(q, a, c, &pad, cbuf, f
|
||||||
, scale_num(PAGES_2K(task->size - task->resident), w, s));
|
, scale_num(PAGES_2K(task->size - task->resident), w, s));
|
||||||
break;
|
break;
|
||||||
case P_TME:
|
case P_TME:
|
||||||
@ -2009,34 +2009,34 @@ static void show_a_task (WIN_t *q, proc_t *task)
|
|||||||
t = task->utime + task->stime;
|
t = task->utime + task->stime;
|
||||||
if (CHKw(q, Show_CTIMES))
|
if (CHKw(q, Show_CTIMES))
|
||||||
t += (task->cutime + task->cstime);
|
t += (task->cutime + task->cstime);
|
||||||
MKCOL(q, i, a, &pad, cbuf, scale_tics(t, w));
|
MKCOL(q, a, c, &pad, cbuf, f, scale_tics(t, w));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case P_TTY:
|
case P_TTY:
|
||||||
{ char tmp[TNYBUFSIZ];
|
{ char tmp[TNYBUFSIZ];
|
||||||
|
|
||||||
dev_to_tty(tmp, (int)w, task->tty, task->pid, ABBREV_DEV);
|
dev_to_tty(tmp, (int)w, task->tty, task->pid, ABBREV_DEV);
|
||||||
MKCOL(q, i, a, &pad, cbuf, tmp);
|
MKCOL(q, a, c, &pad, cbuf, f, tmp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case P_UID:
|
case P_UID:
|
||||||
MKCOL(q, i, a, &pad, cbuf, task->euid);
|
MKCOL(q, a, c, &pad, cbuf, f, (unsigned)task->euid);
|
||||||
break;
|
break;
|
||||||
case P_USR:
|
case P_USR:
|
||||||
MKCOL(q, i, a, &pad, cbuf, task->euser);
|
MKCOL(q, a, c, &pad, cbuf, f, task->euser);
|
||||||
break;
|
break;
|
||||||
case P_VRT:
|
case P_VRT:
|
||||||
MKCOL(q, i, a, &pad, cbuf, scale_num(PAGES_2K(task->size), w, s));
|
MKCOL(q, a, c, &pad, cbuf, f, scale_num(PAGES_2K(task->size), w, s));
|
||||||
break;
|
break;
|
||||||
case P_WCH:
|
case P_WCH:
|
||||||
if (No_ksyms) {
|
if (No_ksyms) {
|
||||||
#ifdef CASEUP_HEXES
|
#ifdef CASEUP_HEXES
|
||||||
MKCOL(q, i, a, &pad, cbuf, fmtmk("x%08lX", (long)task->wchan));
|
MKCOL(q, a, c, &pad, cbuf, "%08lX ", (long)task->wchan);
|
||||||
#else
|
#else
|
||||||
MKCOL(q, i, a, &pad, cbuf, fmtmk("x%08lx", (long)task->wchan));
|
MKCOL(q, a, c, &pad, cbuf, "%08lx ", (long)task->wchan);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
MKCOL(q, i, a, &pad, cbuf, wchan(task->wchan));
|
MKCOL(q, a, c, &pad, cbuf, f, wchan(task->wchan));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2444,17 +2444,6 @@ static proc_t **do_summary (void)
|
|||||||
** Display Memory and Swap space usage */
|
** Display Memory and Swap space usage */
|
||||||
frame_storage();
|
frame_storage();
|
||||||
|
|
||||||
#ifndef YIELDCPU_OFF
|
|
||||||
/* jeeze pucker up, it's time to kiss the scheduler's butt...
|
|
||||||
|
|
||||||
Alright Mr. Kernel, that's ENOUGH already. This swell little program
|
|
||||||
is SICK and TIRED of being PUNISHED for its CAREFUL USE of cpu cycles
|
|
||||||
(quite unlike old top who just threw them away). You constantly make
|
|
||||||
me FIGHT my way back up the RUN-QUEUE! Dammit, I am GOOD, regardless
|
|
||||||
of whether your GOODNESS says so. So here's the deal: I'll yield the
|
|
||||||
darn cpu, if you'll promise to re-dispatch me real soon, ok? */
|
|
||||||
sched_yield();
|
|
||||||
#endif
|
|
||||||
SETw(Curwin, NEWFRAM_cwo);
|
SETw(Curwin, NEWFRAM_cwo);
|
||||||
return p_table;
|
return p_table;
|
||||||
|
|
||||||
|
5
top.h
5
top.h
@ -34,7 +34,6 @@
|
|||||||
//#define PRETEND2_5_X /* pretend we're linux 2.5.x (for IO-wait) */
|
//#define PRETEND2_5_X /* pretend we're linux 2.5.x (for IO-wait) */
|
||||||
//#define PRETEND4CPUS /* pretend we're smp with 4 ticsers (sic) */
|
//#define PRETEND4CPUS /* pretend we're smp with 4 ticsers (sic) */
|
||||||
//#define PRETENDNOCAP /* use a terminal without essential caps */
|
//#define PRETENDNOCAP /* use a terminal without essential caps */
|
||||||
//#define YIELDCPU_OFF /* hang on tight, DON'T issue sched_yield */
|
|
||||||
|
|
||||||
#ifdef PRETEND2_5_X
|
#ifdef PRETEND2_5_X
|
||||||
#define linux_version_code LINUX_VERSION(2,5,43)
|
#define linux_version_code LINUX_VERSION(2,5,43)
|
||||||
@ -118,7 +117,7 @@
|
|||||||
char _str[ROWBUFSIZ]; \
|
char _str[ROWBUFSIZ]; \
|
||||||
snprintf(_str, sizeof(_str), fmt, ## arg); \
|
snprintf(_str, sizeof(_str), fmt, ## arg); \
|
||||||
putp(_str); \
|
putp(_str); \
|
||||||
} while (0);
|
} while (0)
|
||||||
|
|
||||||
/*------ Special Macros (debug and/or informative) ---------------------*/
|
/*------ Special Macros (debug and/or informative) ---------------------*/
|
||||||
|
|
||||||
@ -557,7 +556,7 @@ typedef struct win {
|
|||||||
//atic void cpudo (CPUS_t *cpu, const char *pfx);
|
//atic void cpudo (CPUS_t *cpu, const char *pfx);
|
||||||
//atic void frame_states (proc_t **ppt, int show);
|
//atic void frame_states (proc_t **ppt, int show);
|
||||||
//atic void frame_storage (void);
|
//atic void frame_storage (void);
|
||||||
//atic void mkcol (WIN_t *q, PFLG_t idx, int sta, int *pad, char *buf, ...);
|
//atic void mkcol (WIN_t *q, int a, int c, int *p, char *b, const char *f, ...);
|
||||||
//atic void show_a_task (WIN_t *q, proc_t *task);
|
//atic void show_a_task (WIN_t *q, proc_t *task);
|
||||||
/*------ Main Screen routines ------------------------------------------*/
|
/*------ Main Screen routines ------------------------------------------*/
|
||||||
//atic void do_key (unsigned c);
|
//atic void do_key (unsigned c);
|
||||||
|
Loading…
Reference in New Issue
Block a user