B toggle, fix t toggle, windowed batch, 3x to 6x faster, out-of-bounds RT as "RT"
This commit is contained in:
parent
94d8204f82
commit
d0d827dffe
@ -51,6 +51,7 @@ separate CPUs, but could easily be changed.
|
|||||||
//#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 SORT_SUPRESS /* *attempt* to reduce qsort overhead */
|
//#define SORT_SUPRESS /* *attempt* to reduce qsort overhead */
|
||||||
|
//#define STDOUT_IOLBF /* disable our own stdout _IOFBF override */
|
||||||
//#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 WARN_NOT_SMP /* restrict '1' & 'I' commands to true smp */
|
//#define WARN_NOT_SMP /* restrict '1' & 'I' commands to true smp */
|
||||||
|
|
||||||
|
98
top.1
98
top.1
@ -185,25 +185,26 @@ 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 Off (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 Off
|
* 'p' - PID monitoring Off
|
||||||
* 's' - Secure mode Off (unsecured)
|
* 's' - Secure mode Off (unsecured)
|
||||||
|
'B' - Bold disable Off
|
||||||
\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 states On\ \ (1+1 lines, see '1')
|
||||||
'm' - Mem/Swap stats On\ \ (2 lines worth)
|
'm' - Mem/Swap usage On\ \ (2 lines worth)
|
||||||
'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 Off (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\ \ (pids high-to-low)
|
||||||
* 'S' - Cumulative time Off (exclude dead children)
|
* 'S' - Cumulative time Off (no, dead children)
|
||||||
'x' - Column hilite Off\ (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 Off\ (no, colors)
|
'z' - color/mono Off\ (no, colors)
|
||||||
|
|
||||||
|
|
||||||
.\" ----------------------------------------------------------------------
|
.\" ----------------------------------------------------------------------
|
||||||
@ -438,11 +439,11 @@ The status of the task which can be one of:
|
|||||||
'\fBR\fR' = running
|
'\fBR\fR' = running
|
||||||
'\fBS\fR' = sleeping
|
'\fBS\fR' = sleeping
|
||||||
'\fBT\fR' = traced or stopped
|
'\fBT\fR' = traced or stopped
|
||||||
'\fBZ\fR' = zombies
|
'\fBZ\fR' = zombie
|
||||||
|
|
||||||
Tasks shown as running should be more properly thought of as 'ready to run'
|
Tasks shown as running should be more properly thought of as 'ready to run'
|
||||||
\*(EM their task_struct is simply represented on Linux's run-queue.
|
\*(EM their task_struct is simply represented on the Linux run-queue.
|
||||||
Even without a true SMP machine you may see numerous tasks in this state,
|
Even without a true SMP machine, you may see numerous tasks in this state
|
||||||
depending on \*(Me's delay interval and nice value.
|
depending on \*(Me's delay interval and nice value.
|
||||||
|
|
||||||
.TP 3
|
.TP 3
|
||||||
@ -462,13 +463,10 @@ fit in this field's current width.
|
|||||||
That width depends upon other fields selected, their order and the current
|
That width depends upon other fields selected, their order and the current
|
||||||
screen width.
|
screen width.
|
||||||
|
|
||||||
.in +4
|
\*(NT The 'Command' field/column is unique, in that it is not fixed-width.
|
||||||
\*(NT The 'Command' field/column is unique, in that it is not fixed-width,
|
When displayed, this column will be allocated all remaining screen width (up
|
||||||
like all other fields.
|
to the maximum 512 characters) to provide for the potential growth of program
|
||||||
When displayed, this column will be allocated all remaining screen width,
|
names into command lines.
|
||||||
up to the maximum 512 characters, so as to provide for the potential growth of
|
|
||||||
program names into command lines!
|
|
||||||
.in
|
|
||||||
|
|
||||||
.TP 3
|
.TP 3
|
||||||
y:\fB WCHAN\fR \*(EM Sleeping in Function
|
y:\fB WCHAN\fR \*(EM Sleeping in Function
|
||||||
@ -477,11 +475,9 @@ will show the name or the address of the kernel function in which the task is
|
|||||||
currently sleeping.
|
currently sleeping.
|
||||||
Running tasks will display a dash ('-') in this column.
|
Running tasks will display a dash ('-') in this column.
|
||||||
|
|
||||||
.in +4
|
|
||||||
\*(NT By displaying this field, \*(Me's own working set will be increased by
|
\*(NT By displaying this field, \*(Me's own working set will be increased by
|
||||||
over 700Kb.
|
over 700Kb.
|
||||||
Your only means of reducing that overhead will be to stop and restart \*(Me.
|
Your only means of reducing that overhead will be to stop and restart \*(Me.
|
||||||
.in
|
|
||||||
|
|
||||||
.TP 3
|
.TP 3
|
||||||
z:\fB Flags\fR \*(EM Task Flags
|
z:\fB Flags\fR \*(EM Task Flags
|
||||||
@ -538,7 +534,7 @@ Some commands appear more than once \*(EM their meaning or scope may vary
|
|||||||
depending on the context in which they are issued.
|
depending on the context in which they are issued.
|
||||||
|
|
||||||
3a.\fI GLOBAL_Commands\fR
|
3a.\fI GLOBAL_Commands\fR
|
||||||
<Ret>, <Sp> ?, =, A, d, G, h, I, k, q, r, s, W, Z
|
<Ret/Sp> ?, =, A, B, d, G, h, I, k, q, r, s, W, Z
|
||||||
3b.\fI SUMMARY_Area_Commands\fR
|
3b.\fI SUMMARY_Area_Commands\fR
|
||||||
l, m, t, 1
|
l, m, t, 1
|
||||||
3c.\fI TASK_Area_Commands\fR
|
3c.\fI TASK_Area_Commands\fR
|
||||||
@ -547,7 +543,7 @@ depending on the context in which they are issued.
|
|||||||
Size: #, i, n
|
Size: #, i, n
|
||||||
Sorting: <, >, F, O, R
|
Sorting: <, >, F, O, R
|
||||||
3d.\fI COLOR_Mapping\fR
|
3d.\fI COLOR_Mapping\fR
|
||||||
<Ret>, a, b, H, M, q, S, T, w, z, 0 - 7
|
<Ret>, a, B, b, H, M, q, S, T, w, z, 0 - 7
|
||||||
4b.\fI COMMANDS_for_Windows\fR
|
4b.\fI COMMANDS_for_Windows\fR
|
||||||
-, _, =, +, A, a, G, g, w
|
-, _, =, +, A, a, G, g, w
|
||||||
|
|
||||||
@ -562,12 +558,12 @@ simply ask for help and view the system summary on the second line.
|
|||||||
|
|
||||||
.TP 7
|
.TP 7
|
||||||
\ \ \<\fBEnter\fR> or <\fBSpace\fR> :\fIRefresh_Display\fR
|
\ \ \<\fBEnter\fR> or <\fBSpace\fR> :\fIRefresh_Display\fR
|
||||||
In truth, these commands do nothing, they are simply ignored.
|
These commands do nothing, they are simply ignored.
|
||||||
However, they will awaken \*(Me and following receipt of any input
|
However, they will awaken \*(Me and following receipt of any input
|
||||||
the entire display will be repainted within milliseconds.
|
the entire display will be repainted.
|
||||||
|
|
||||||
If you have set a large delay interval and wish to see current status,
|
Use either of these keys if you have a large delay interval and wish to
|
||||||
just use either of these keys.
|
see current status,
|
||||||
|
|
||||||
.TP 7
|
.TP 7
|
||||||
\ \ \'\fB?\fR\' or \'\fBh\fR\' :\fIHelp\fR
|
\ \ \'\fB?\fR\' or \'\fBh\fR\' :\fIHelp\fR
|
||||||
@ -594,6 +590,18 @@ This command will switch between \*(FM and \*(AM.
|
|||||||
\*(XT 4. ALTERNATE\-DISPLAY Mode and the 'G' \*(CI for insight into
|
\*(XT 4. ALTERNATE\-DISPLAY Mode and the 'G' \*(CI for insight into
|
||||||
\*(CWs and field groups.
|
\*(CWs and field groups.
|
||||||
|
|
||||||
|
.TP 7
|
||||||
|
\ \ \'\fBB\fR\' :\fIBold_Disable/Enable_toggle\fR
|
||||||
|
This command will influence use of the 'bold' terminfo capability and
|
||||||
|
alters\fB both\fR the \*(SA and \*(TA for the \*(CW.
|
||||||
|
While it is intended primarily for use with dumb terminals, it can be
|
||||||
|
applied anytime.
|
||||||
|
|
||||||
|
\*(NT When this toggle is \*O and \*(Me is operating in monochrome mode,
|
||||||
|
the\fB entire display\fR will appear as normal text.
|
||||||
|
Thus, unless the 'x' and/or 'y' toggles are using reverse for emphasis,
|
||||||
|
there will be no visual confirmation that they are even on.
|
||||||
|
|
||||||
.TP 7
|
.TP 7
|
||||||
*\ \'\fBd\fR\' or \'\fBs\fR\' :\fIChange_Delay_Time_interval\fR
|
*\ \'\fBd\fR\' or \'\fBs\fR\' :\fIChange_Delay_Time_interval\fR
|
||||||
You will be prompted to enter the delay time, in seconds, between
|
You will be prompted to enter the delay time, in seconds, between
|
||||||
@ -709,7 +717,12 @@ The \*(TA \*(CIs are\fB never available\fR in \*(AM\fI if\fR the \*(CW's
|
|||||||
.PP
|
.PP
|
||||||
.\" .........................
|
.\" .........................
|
||||||
.B APPEARANCE\fR of \*(TW
|
.B APPEARANCE\fR of \*(TW
|
||||||
.PD 0
|
.br
|
||||||
|
.in +2
|
||||||
|
The following commands will also be influenced by the state of the
|
||||||
|
global 'B' (bold disable) toggle.
|
||||||
|
.in
|
||||||
|
|
||||||
.TP 7
|
.TP 7
|
||||||
\ \ \'\fBb\fR\' :\fIBold/Reverse_toggle\fR
|
\ \ \'\fBb\fR\' :\fIBold/Reverse_toggle\fR
|
||||||
This command will impact how the 'x' and 'y' toggles are displayed.
|
This command will impact how the 'x' and 'y' toggles are displayed.
|
||||||
@ -809,7 +822,7 @@ simply decrease the size of the \*(TD(s) above it.
|
|||||||
.br
|
.br
|
||||||
.in +2
|
.in +2
|
||||||
Before using any of these sort provisions, \*(Me suggests that you
|
Before using any of these sort provisions, \*(Me suggests that you
|
||||||
temporarily turn on column highlighting using the '\fBx\fR' \*(CI.
|
temporarily turn on column highlighting using the 'x' \*(CI.
|
||||||
That will help ensure that the actual sort environment matches your intent.
|
That will help ensure that the actual sort environment matches your intent.
|
||||||
|
|
||||||
The following \*(CIs will\fB only\fR be honored when the
|
The following \*(CIs will\fB only\fR be honored when the
|
||||||
@ -869,7 +882,8 @@ in all four windows before returning to the \*(Me display.
|
|||||||
\fB4\fR upper case letters to select a\fB target\fR
|
\fB4\fR upper case letters to select a\fB target\fR
|
||||||
\fB8\fR numbers to select a\fB color\fR
|
\fB8\fR numbers to select a\fB color\fR
|
||||||
normal toggles available\fR
|
normal toggles available\fR
|
||||||
'b' :bold/reverse
|
'B' :bold disable/enable
|
||||||
|
'b' :running tasks "bold"/reverse
|
||||||
'z' :color/mono
|
'z' :color/mono
|
||||||
other commands available\fR
|
other commands available\fR
|
||||||
'a'/'w' :apply, then go to next/prior
|
'a'/'w' :apply, then go to next/prior
|
||||||
@ -901,7 +915,7 @@ 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.
|
||||||
|
|
||||||
In \*(AM, those 4 underlying\fB field groups\fR can now be made visible
|
In \*(AM, those 4 underlying field groups can now be made visible
|
||||||
simultaneously, or can be turned \*F individually at your command.
|
simultaneously, or can be turned \*F individually at your command.
|
||||||
|
|
||||||
The \*(SA will always exist, even if it's only the message line.
|
The \*(SA will always exist, even if it's only the message line.
|
||||||
@ -1032,9 +1046,9 @@ personal \*(CF to the current directory, subject to permissions.
|
|||||||
.\" ----------------------------------------------------------------------
|
.\" ----------------------------------------------------------------------
|
||||||
.SH 6. STUPID TRICKS Sampler
|
.SH 6. STUPID TRICKS Sampler
|
||||||
.\" ----------------------------------------------------------------------
|
.\" ----------------------------------------------------------------------
|
||||||
Many of these 'tricks' work best when you give \*(Me a scheduling boost
|
Many of these 'tricks' work best when you give \*(Me a scheduling boost.
|
||||||
\*(EM so plan on starting him with a nice value of -10 (assuming you've got
|
So plan on starting him with a nice value of -10, assuming you've got
|
||||||
the authority).
|
the authority.
|
||||||
|
|
||||||
.\" ......................................................................
|
.\" ......................................................................
|
||||||
.SS 6a. Kernel Magic
|
.SS 6a. Kernel Magic
|
||||||
|
207
top.h
207
top.h
@ -34,6 +34,7 @@
|
|||||||
//#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 STDOUT_IOLBF /* disable our own stdout _IOFBF override */
|
||||||
|
|
||||||
#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)
|
||||||
@ -68,8 +69,6 @@
|
|||||||
#define OURPATHSZ 1024
|
#define OURPATHSZ 1024
|
||||||
#define BIGBUFSIZ 2048
|
#define BIGBUFSIZ 2048
|
||||||
#define USRNAMSIZ GETBUFSIZ
|
#define USRNAMSIZ GETBUFSIZ
|
||||||
/* colbufsz does NOT apply to command lines - that field uses rowbufsz */
|
|
||||||
#define COLBUFSIZ SMLBUFSIZ + CLRBUFSIZ
|
|
||||||
#define ROWBUFSIZ SCREENMAX + CLRBUFSIZ
|
#define ROWBUFSIZ SCREENMAX + CLRBUFSIZ
|
||||||
|
|
||||||
|
|
||||||
@ -82,7 +81,6 @@
|
|||||||
#define BYTES_2K(n) (unsigned)( (n) >> 10 )
|
#define BYTES_2K(n) (unsigned)( (n) >> 10 )
|
||||||
#define PAGES_2B(n) (unsigned)( (n) * Page_size )
|
#define PAGES_2B(n) (unsigned)( (n) * Page_size )
|
||||||
#define PAGES_2K(n) BYTES_2K(PAGES_2B(n))
|
#define PAGES_2K(n) BYTES_2K(PAGES_2B(n))
|
||||||
#define PAGE_CNT(n) (unsigned)( (n) / Page_size )
|
|
||||||
|
|
||||||
/* Used as return arguments in *some* of the sort callbacks */
|
/* Used as return arguments in *some* of the sort callbacks */
|
||||||
#define SORT_lt ( Frame_srtflg > 0 ? 1 : -1 )
|
#define SORT_lt ( Frame_srtflg > 0 ? 1 : -1 )
|
||||||
@ -110,14 +108,37 @@
|
|||||||
static int sort_ ## f (const proc_t **P, const proc_t **Q) { \
|
static int sort_ ## f (const proc_t **P, const proc_t **Q) { \
|
||||||
return Frame_srtflg * strcmp((*Q)->s, (*P)->s); }
|
return Frame_srtflg * strcmp((*Q)->s, (*P)->s); }
|
||||||
|
|
||||||
/* Used to 'inline' those portions of the display requiring formatting
|
/* Used in the following ways, to 'inline' those portions of the
|
||||||
while ensuring we won't be blindsided by some whacko terminal's
|
display requiring formatting while protecting against potential
|
||||||
'$<..>' (millesecond delay) lurking in a terminfo string. */
|
embedded 'millesecond delay' escape sequences.
|
||||||
#define PUTP(fmt,arg...) do { \
|
PUTT - Put to Tty
|
||||||
char _str[ROWBUFSIZ]; \
|
. for temporary interactive 'REPLACEMENT' output
|
||||||
snprintf(_str, sizeof(_str), fmt, ## arg); \
|
. may contain ANY valid terminfo escape sequences
|
||||||
putp(_str); \
|
. need NOT represent an entire screen row
|
||||||
} while (0)
|
PUFF - Put for Frame
|
||||||
|
. for more permanent frame-oriented 'UPDATE' output
|
||||||
|
. may NOT contain cursor motion terminfo escapes
|
||||||
|
. represents a complete screen ROW
|
||||||
|
. subject to optimization, thus MAY be discarded
|
||||||
|
. when discarded, replaced by a NEWLINE */
|
||||||
|
#define PUTT(fmt,arg...) do { \
|
||||||
|
char _str[ROWBUFSIZ]; \
|
||||||
|
snprintf(_str, sizeof(_str), fmt, ## arg); \
|
||||||
|
putp(_str); \
|
||||||
|
} while (0)
|
||||||
|
#define PUFF(fmt,arg...) do { \
|
||||||
|
char _str[ROWBUFSIZ]; \
|
||||||
|
register char *_ptr = &Pseudo_scrn[Pseudo_row * Pseudo_cols]; \
|
||||||
|
register int _len = snprintf(_str, sizeof(_str), fmt, ## arg); \
|
||||||
|
if (Batch) fputs(_str, stdout); \
|
||||||
|
else { \
|
||||||
|
if (!memcmp(_ptr, _str, _len)) \
|
||||||
|
putchar('\n'); \
|
||||||
|
else { \
|
||||||
|
memcpy(_ptr, _str, ++_len); \
|
||||||
|
putp(_ptr); \
|
||||||
|
} } Pseudo_row++; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*------ Special Macros (debug and/or informative) ---------------------*/
|
/*------ Special Macros (debug and/or informative) ---------------------*/
|
||||||
|
|
||||||
@ -153,6 +174,7 @@ typedef struct {
|
|||||||
const int scale; /* scale_num type, if applicable */
|
const int scale; /* scale_num type, if applicable */
|
||||||
const QSORT_t sort; /* sort function */
|
const QSORT_t sort; /* sort function */
|
||||||
const char *desc; /* description for toggle/reorder fields */
|
const char *desc; /* description for toggle/reorder fields */
|
||||||
|
const int lflg; /* PROC_FILLxxx flag(s) required for this field */
|
||||||
} FTAB_t;
|
} FTAB_t;
|
||||||
|
|
||||||
/* This structure stores one piece of critical 'history'
|
/* This structure stores one piece of critical 'history'
|
||||||
@ -167,9 +189,9 @@ typedef struct {
|
|||||||
calculations. It exists primarily for SMP support but serves
|
calculations. It exists primarily for SMP support but serves
|
||||||
all environments. */
|
all environments. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* ticks count as represented in /proc/stat */
|
// ticks count as represented in /proc/stat
|
||||||
TICS_t u, n, s, i, w;
|
TICS_t u, n, s, i, w;
|
||||||
/* tics count in the order of our display */
|
// tics count in the order of our display
|
||||||
TICS_t u_sav, s_sav, n_sav, i_sav, w_sav;
|
TICS_t u_sav, s_sav, n_sav, i_sav, w_sav;
|
||||||
} CPUS_t;
|
} CPUS_t;
|
||||||
|
|
||||||
@ -204,17 +226,15 @@ enum pflag {
|
|||||||
#define Flags_OFF 3
|
#define Flags_OFF 3
|
||||||
|
|
||||||
/* The Persistent 'Mode' flags!
|
/* The Persistent 'Mode' flags!
|
||||||
All of these are preserved in the rc file, as a single integer.
|
These are preserved in the rc file, as a single integer and the
|
||||||
Thus, once personalized, this top will stay personalized across
|
letter shown is the corresponding 'command' toggle */
|
||||||
restarts (not like the old top, who only remembered fields)!
|
// 'View_' flags affect the summary (minimum), taken from 'Curwin'
|
||||||
Note: the letter shown is the corresponding 'command' toggle
|
|
||||||
*/
|
|
||||||
/* 'View_' flags affect the summary information, taken from 'Curwin' */
|
|
||||||
#define View_CPUSUM 0x8000 /* '1' - show combined cpu stats (vs. each) */
|
#define View_CPUSUM 0x8000 /* '1' - show combined cpu stats (vs. each) */
|
||||||
#define View_LOADAV 0x4000 /* 'l' - display load avg and uptime summary */
|
#define View_LOADAV 0x4000 /* 'l' - display load avg and uptime summary */
|
||||||
#define View_STATES 0x2000 /* 't' - display task/cpu(s) states summary */
|
#define View_STATES 0x2000 /* 't' - display task/cpu(s) states summary */
|
||||||
#define View_MEMORY 0x1000 /* 'm' - display memory summary */
|
#define View_MEMORY 0x1000 /* 'm' - display memory summary */
|
||||||
/* 'Show_' & 'Qsrt_' flags are for task display in a visible window */
|
#define View_NOBOLD 0x0001 /* 'B' - disable 'bold' attribute globally */
|
||||||
|
// 'Show_' & 'Qsrt_' flags are for task display in a visible window
|
||||||
#define Show_COLORS 0x0800 /* 'z' - show in color (vs. mono) */
|
#define Show_COLORS 0x0800 /* 'z' - show in color (vs. mono) */
|
||||||
#define Show_HIBOLD 0x0400 /* 'b' - rows and/or cols bold (vs. reverse) */
|
#define Show_HIBOLD 0x0400 /* 'b' - rows and/or cols bold (vs. reverse) */
|
||||||
#define Show_HICOLS 0x0200 /* 'x' - show sort column highlighted */
|
#define Show_HICOLS 0x0200 /* 'x' - show sort column highlighted */
|
||||||
@ -228,16 +248,15 @@ enum pflag {
|
|||||||
#define NEWFRAM_cwo 0x0004 /* new frame (if anyone cares) - in Curwin */
|
#define NEWFRAM_cwo 0x0004 /* new frame (if anyone cares) - in Curwin */
|
||||||
#define EQUWINS_cwo 0x0002 /* rebalance tasks next frame (off 'i'/ 'n') */
|
#define EQUWINS_cwo 0x0002 /* rebalance tasks next frame (off 'i'/ 'n') */
|
||||||
/* ...set in Curwin, but impacts all windows */
|
/* ...set in Curwin, but impacts all windows */
|
||||||
#define flag_unused 0x0001 /* ----------------------- future use, maybe */
|
|
||||||
|
|
||||||
/* Current-window-only flags -- always turned off at end-of-window! */
|
// Current-window-only flags -- always turned off at end-of-window!
|
||||||
#define FLGSOFF_cwo EQUWINS_cwo | NEWFRAM_cwo
|
#define FLGSOFF_cwo EQUWINS_cwo | NEWFRAM_cwo
|
||||||
|
|
||||||
/* Default flags if there's no rcfile to provide user customizations */
|
// Default flags if there's no rcfile to provide user customizations
|
||||||
#define DEF_WINFLGS ( View_LOADAV | View_STATES | View_CPUSUM | View_MEMORY | \
|
#define DEF_WINFLGS ( View_LOADAV | View_STATES | View_CPUSUM | View_MEMORY | \
|
||||||
Show_HIBOLD | Show_HIROWS | Show_IDLEPS | Qsrt_NORMAL | VISIBLE_tsk )
|
Show_HIBOLD | Show_HIROWS | Show_IDLEPS | Qsrt_NORMAL | VISIBLE_tsk )
|
||||||
|
|
||||||
/* Used to test/manipulate the window flags */
|
// Used to test/manipulate the window flags
|
||||||
#define CHKw(q,f) (int)(q->winflags & (f))
|
#define CHKw(q,f) (int)(q->winflags & (f))
|
||||||
#define TOGw(q,f) q->winflags ^= (f)
|
#define TOGw(q,f) q->winflags ^= (f)
|
||||||
#define SETw(q,f) q->winflags |= (f)
|
#define SETw(q,f) q->winflags |= (f)
|
||||||
@ -275,6 +294,7 @@ typedef struct win {
|
|||||||
capclr_hdr [CLRBUFSIZ], /* note: sum, msg and pmt strs */
|
capclr_hdr [CLRBUFSIZ], /* note: sum, msg and pmt strs */
|
||||||
capclr_rowhigh [CLRBUFSIZ], /* are only used when this */
|
capclr_rowhigh [CLRBUFSIZ], /* are only used when this */
|
||||||
capclr_rownorm [CLRBUFSIZ]; /* window is the 'Curwin'! */
|
capclr_rownorm [CLRBUFSIZ]; /* window is the 'Curwin'! */
|
||||||
|
char cap_bold [CAPBUFSIZ]; /* support for View_NOBOLD toggle */
|
||||||
char grpname [GRPNAMSIZ], /* window number:name, printable */
|
char grpname [GRPNAMSIZ], /* window number:name, printable */
|
||||||
winname [WINNAMSIZ], /* window name, user changeable */
|
winname [WINNAMSIZ], /* window name, user changeable */
|
||||||
fieldscur [PFLAGSSIZ], /* fields displayed and ordered */
|
fieldscur [PFLAGSSIZ], /* fields displayed and ordered */
|
||||||
@ -326,19 +346,19 @@ typedef struct win {
|
|||||||
#define STATES_line1 "Tasks:\03" \
|
#define STATES_line1 "Tasks:\03" \
|
||||||
" %3u \02total,\03 %3u \02running,\03 %3u \02sleeping,\03 %3u \02stopped,\03 %3u \02zombie\03\n"
|
" %3u \02total,\03 %3u \02running,\03 %3u \02sleeping,\03 %3u \02stopped,\03 %3u \02zombie\03\n"
|
||||||
#define STATES_line2x4 "%s\03" \
|
#define STATES_line2x4 "%s\03" \
|
||||||
" %#5.1f\02%% user,\03 %#5.1f\02%% system,\03 %#5.1f\02%% nice,\03 %#5.1f\02%% idle\03\n"
|
" %#5.1f%% \02user,\03 %#5.1f%% \02system,\03 %#5.1f%% \02nice,\03 %#5.1f%% \02idle\03\n"
|
||||||
#define STATES_line2x5 "%s\03" \
|
#define STATES_line2x5 "%s\03" \
|
||||||
" %#5.1f\02%% user,\03 %#5.1f\02%% system,\03 %#5.1f\02%% nice,\03 %#5.1f\02%% idle,\03 %#5.1f\02%% IO-wait\03\n"
|
" %#5.1f%% \02user,\03 %#5.1f%% \02system,\03 %#5.1f%% \02nice,\03 %#5.1f%% \02idle,\03 %#5.1f%% \02IO-wait\03\n"
|
||||||
#ifdef CASEUP_SUMMK
|
#ifdef CASEUP_SUMMK
|
||||||
#define MEMORY_line1 "Mem: \03" \
|
#define MEMORY_line1 "Mem: \03" \
|
||||||
" %8u\02K total,\03 %8u\02K used,\03 %8u\02K free,\03 %8u\02K buffers\03\n"
|
" %8uK \02total,\03 %8uK \02used,\03 %8uK \02free,\03 %8uK \02buffers\03\n"
|
||||||
#define MEMORY_line2 "Swap:\03" \
|
#define MEMORY_line2 "Swap:\03" \
|
||||||
" %8u\02K total,\03 %8u\02K used,\03 %8u\02K free,\03 %8u\02K cached\03\n"
|
" %8uK \02total,\03 %8uK \02used,\03 %8uK \02free,\03 %8uK \02cached\03\n"
|
||||||
#else
|
#else
|
||||||
#define MEMORY_line1 "Mem: \03" \
|
#define MEMORY_line1 "Mem: \03" \
|
||||||
" %8u\02k total,\03 %8u\02k used,\03 %8u\02k free,\03 %8u\02k buffers\03\n"
|
" %8uk \02total,\03 %8uk \02used,\03 %8uk \02free,\03 %8uk \02buffers\03\n"
|
||||||
#define MEMORY_line2 "Swap:\03" \
|
#define MEMORY_line2 "Swap:\03" \
|
||||||
" %8u\02k total,\03 %8u\02k used,\03 %8u\02k free,\03 %8u\02k cached\03\n"
|
" %8uk \02total,\03 %8uk \02used,\03 %8uk \02free,\03 %8uk \02cached\03\n"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Keyboard Help specially formatted string(s) --
|
/* Keyboard Help specially formatted string(s) --
|
||||||
@ -347,17 +367,17 @@ typedef struct win {
|
|||||||
"Help for Interactive Commands\02 - %s\n" \
|
"Help for Interactive Commands\02 - %s\n" \
|
||||||
"Window \01%s\06: \01Cumulative mode \03%s\02. \01System\06: \01Delay \03%.1f secs\02; \01Secure mode \03%s\02.\n" \
|
"Window \01%s\06: \01Cumulative mode \03%s\02. \01System\06: \01Delay \03%.1f secs\02; \01Secure mode \03%s\02.\n" \
|
||||||
"\n" \
|
"\n" \
|
||||||
" l,t,m Toggle Summary: '\01l\02' load avg; '\01t\02' task/cpu stats; '\01m\02' mem info\n" \
|
" Z\05,\01B\05 Global: '\01Z\02' change color mappings; '\01B\02' disable/enable bold\n" \
|
||||||
|
" l,t,m Toggle Summaries: '\01l\02' load avg; '\01t\02' task/cpu stats; '\01m\02' mem info\n" \
|
||||||
" 1,I Toggle SMP view: '\0011\02' single/separate states; '\01I\02' Irix/Solaris mode\n" \
|
" 1,I Toggle SMP view: '\0011\02' single/separate states; '\01I\02' Irix/Solaris mode\n" \
|
||||||
" Z\05 Change color mappings\n" \
|
|
||||||
"\n" \
|
"\n" \
|
||||||
" f,o . Fields/Columns: '\01f\02' add or remove; '\01o\02' change display order\n" \
|
" f,o . Fields/Columns: '\01f\02' add or remove; '\01o\02' change display order\n" \
|
||||||
" F or O . Select sort field\n" \
|
" F or O . Select sort field\n" \
|
||||||
" <,> . Move sort field: '\01<\02' next col left; '\01>\02' next col right\n" \
|
" <,> . Move sort field: '\01<\02' next col left; '\01>\02' next col right\n" \
|
||||||
" R . Toggle normal/reverse sort\n" \
|
" R . Toggle normal/reverse sort\n" \
|
||||||
" c,i,S . Toggle: '\01c\02' cmd name/line; '\01i\02' idle tasks; '\01S\02' cumulative time\n" \
|
" c,i,S . Toggle: '\01c\02' cmd name/line; '\01i\02' idle tasks; '\01S\02' cumulative time\n" \
|
||||||
" x,y\05 . Toggle highlights: '\01x\02' sort field; '\01y\02' running tasks\n" \
|
" x\05,\01y\05 . Toggle highlights: '\01x\02' sort field; '\01y\02' running tasks\n" \
|
||||||
" z,b\05 . Toggle: '\01z\02' color/mono; '\01b\02' bold/reverse (only if 'x' or 'y')\n" \
|
" z\05,\01b\05 . Toggle: '\01z\02' color/mono; '\01b\02' bold/reverse (only if 'x' or 'y')\n" \
|
||||||
" u . Show specific user only\n" \
|
" u . Show specific user only\n" \
|
||||||
" n or # . Set maximum tasks displayed\n" \
|
" n or # . Set maximum tasks displayed\n" \
|
||||||
"\n" \
|
"\n" \
|
||||||
@ -440,15 +460,16 @@ typedef struct win {
|
|||||||
"Help for color mapping\02 - %s\n" \
|
"Help for color mapping\02 - %s\n" \
|
||||||
"current window: \01%s\06\n" \
|
"current window: \01%s\06\n" \
|
||||||
"\n" \
|
"\n" \
|
||||||
" color -\03 04:25:44 up 8 days, 50 min, 7 users, load average:\n" \
|
" color - 04:25:44 up 8 days, 50 min, 7 users, load average:\n" \
|
||||||
" Tasks:\03 64 \02total,\03 2 \02running,\03 62 \02sleeping,\03 0 \02stopped,\03\n" \
|
" Tasks:\03 64 \02total,\03 2 \03running,\03 62 \02sleeping,\03 0 \02stopped,\03\n" \
|
||||||
" State cpu0 :\03 76.5\02%% user,\03 11.2\02%% system,\03 0.0\02%% nice,\03\n" \
|
" Cpu(s):\03 76.5%% \02user,\03 11.2%% \02system,\03 0.0%% \02nice,\03 12.3%% \02idle\03\n" \
|
||||||
" \01 Nasty Message! \04 -or- \01Input Prompt\05\n" \
|
" \01 Nasty Message! \04 -or- \01Input Prompt\05\n" \
|
||||||
" \01 PID TTY PR NI %%CPU TIME+ VIRT SWAP STA Command \06\n" \
|
" \01 PID TTY PR NI %%CPU TIME+ VIRT SWAP STA Command \06\n" \
|
||||||
" 17284 \10pts/2 \07 8 0 0.0 0:00.75 1380 0 S /bin/bash \10\n" \
|
" 17284 \10pts/2 \07 8 0 0.0 0:00.75 1380 0 S /bin/bash \10\n" \
|
||||||
" \01 8601 pts/1 7 -10 0.4 0:00.03 916 0 R < color -b \07\n" \
|
" \01 8601 pts/1 7 -10 0.4 0:00.03 916 0 R < color -b \07\n" \
|
||||||
" 11005 \10? \07 9 0 0.0 0:02.50 2852 1008 S amor -ses \10\n" \
|
" 11005 \10? \07 9 0 0.0 0:02.50 2852 1008 S amor -ses \10\n" \
|
||||||
" available toggles: \01b\02 =bold/reverse (\01%s\02), \01z\02 =color/mono (\01%s\02)\n" \
|
" available toggles: \01B\02 =disable bold globally (\01%s\02),\n" \
|
||||||
|
" \01z\02 =color/mono (\01%s\02), \01b\02 =tasks \"bold\"/reverse (\01%s\02)\n" \
|
||||||
"\n" \
|
"\n" \
|
||||||
"Select \01target\02 as upper case letter:\n" \
|
"Select \01target\02 as upper case letter:\n" \
|
||||||
" S\02 = Summary Data,\01 M\02 = Messages/Prompts,\n" \
|
" S\02 = Summary Data,\01 M\02 = Messages/Prompts,\n" \
|
||||||
@ -500,74 +521,74 @@ typedef struct win {
|
|||||||
* source code navigation, which often influences the identifers. */
|
* source code navigation, which often influences the identifers. */
|
||||||
/*------ Sort callbacks ------------------------------------------------*/
|
/*------ Sort callbacks ------------------------------------------------*/
|
||||||
/* for each possible field, in the form of: */
|
/* for each possible field, in the form of: */
|
||||||
/*atic int sort_P_XXX (const proc_t **P, const proc_t **Q); */
|
/*atic int sort_P_XXX (const proc_t **P, const proc_t **Q); */
|
||||||
//atic int sort_HIST_t (const HIST_t *P, const HIST_t *Q);
|
/* additional specialized sort callback(s) */
|
||||||
|
static int sort_HIST_t (const HIST_t *P, const HIST_t *Q);
|
||||||
/*------ Tiny useful routine(s) ----------------------------------------*/
|
/*------ Tiny useful routine(s) ----------------------------------------*/
|
||||||
//atic int chin (int ech, char *buf, unsigned cnt);
|
//atic int chin (int ech, char *buf, unsigned cnt);
|
||||||
//atic const char *fmtmk (const char *fmts, ...);
|
//atic const char *fmtmk (const char *fmts, ...);
|
||||||
//atic char *strim (int sp, char *str);
|
//atic inline char *scat (register char *dst, register const char *src);
|
||||||
//atic const char *tg2 (int x, int y);
|
//atic char *strim (int sp, char *str);
|
||||||
|
//atic const char *tg2 (int x, int y);
|
||||||
/*------ Exit/Interrput routines ---------------------------------------*/
|
/*------ Exit/Interrput routines ---------------------------------------*/
|
||||||
//atic void bye_bye (int eno, const char *str);
|
//atic void bye_bye (int eno, const char *str);
|
||||||
//atic void stop (int dont_care_sig);
|
//atic void end_pgm (int dont_care_sig);
|
||||||
//atic void std_err (const char *str);
|
//atic void std_err (const char *str);
|
||||||
//atic void suspend (int dont_care_sig);
|
//atic void suspend (int dont_care_sig);
|
||||||
/*------ Misc Color/Display support ------------------------------------*/
|
/*------ Misc Color/Display support ------------------------------------*/
|
||||||
//atic void capsmk (WIN_t *q);
|
//atic void capsmk (WIN_t *q);
|
||||||
//atic void msg_save (const char *fmts, ...);
|
//atic void msg_save (const char *fmts, ...);
|
||||||
//atic void show_msg (const char *str);
|
//atic void show_msg (const char *str);
|
||||||
//atic void show_pmt (const char *str);
|
//atic void show_pmt (const char *str);
|
||||||
//atic void show_special (const char *glob);
|
//atic void show_special (int interact, const char *glob);
|
||||||
/*------ Small Utility routines ----------------------------------------*/
|
/*------ Small Utility routines ----------------------------------------*/
|
||||||
//atic char *ask4str (const char *prompt);
|
//atic char *ask4str (const char *prompt);
|
||||||
//atic float get_float (const char *prompt);
|
//atic float get_float (const char *prompt);
|
||||||
//atic int get_int (const char *prompt);
|
//atic int get_int (const char *prompt);
|
||||||
//atic const char *scale_num (unsigned num, const int width, const unsigned type);
|
//atic const char *scale_num (unsigned num, const int width, const unsigned type);
|
||||||
//atic const char *scale_tics (TICS_t tics, const int width);
|
//atic const char *scale_tics (TICS_t tics, const int width);
|
||||||
/*------ Library Alternatives ------------------------------------------*/
|
/*------ Library Alternatives ------------------------------------------*/
|
||||||
//atic void *alloc_c (unsigned numb);
|
//atic void *alloc_c (unsigned numb);
|
||||||
//atic void *alloc_r (void *q, unsigned numb);
|
//atic void *alloc_r (void *q, unsigned numb);
|
||||||
//atic CPUS_t *cpus_refresh (CPUS_t *cpus);
|
//atic CPUS_t *cpus_refresh (CPUS_t *cpus);
|
||||||
//atic void prochlp (proc_t *this);
|
//atic void prochlp (register proc_t *this);
|
||||||
//atic proc_t **procs_refresh (proc_t **table, int flags);
|
//atic proc_t **procs_refresh (proc_t **table, int flags);
|
||||||
/*------ Startup routines ----------------------------------------------*/
|
/*------ Startup routines ----------------------------------------------*/
|
||||||
//atic void before (char *me);
|
//atic void before (char *me);
|
||||||
//atic void configs_read (void);
|
//atic void configs_read (void);
|
||||||
//atic void parse_args (char **args);
|
//atic void parse_args (char **args);
|
||||||
//atic void whack_terminal (void);
|
//atic void whack_terminal (void);
|
||||||
/*------ Field Selection/Ordering routines -----------------------------*/
|
/*------ Field Selection/Ordering routines -----------------------------*/
|
||||||
/*atic FTAB_t Fieldstab[] = { ... } */
|
/*atic FTAB_t Fieldstab[] = { ... } */
|
||||||
//atic void display_fields (const char *fields, const char *xtra);
|
//atic void display_fields (const char *fields, const char *xtra);
|
||||||
//atic void fields_reorder (void);
|
//atic void fields_reorder (void);
|
||||||
//atic void fields_sort (void);
|
//atic void fields_sort (void);
|
||||||
//atic void fields_toggle (void);
|
//atic void fields_toggle (void);
|
||||||
/*------ Windows/Field Groups support ----------------------------------*/
|
/*------ Windows/Field Groups support ----------------------------------*/
|
||||||
//atic void win_colsheads (WIN_t *q);
|
//atic void reframewins (void);
|
||||||
//atic inline int win_fldviz (WIN_t *q, PFLG_t flg);
|
//atic void win_names (WIN_t *q, const char *name);
|
||||||
//atic void win_names (WIN_t *q, const char *name);
|
//atic void win_select (char ch);
|
||||||
//atic void win_select (char ch);
|
//atic int win_warn (void);
|
||||||
//atic int win_warn (void);
|
//atic void winsclrhlp (WIN_t *q, int save);
|
||||||
//atic void winsclrhlp (WIN_t *q, int save);
|
//atic void wins_colors (void);
|
||||||
//atic void wins_colors (void);
|
//atic void wins_reflag (int what, int flg);
|
||||||
//atic void wins_reflag (int what, int flg);
|
//atic void wins_resize (int dont_care_sig);
|
||||||
//atic void wins_resize (int dont_care_sig);
|
//atic void windows_stage1 (void);
|
||||||
//atic void windows_stage1 (void);
|
//atic void windows_stage2 (void);
|
||||||
//atic void windows_stage2 (void);
|
|
||||||
/*------ Main Screen routines ------------------------------------------*/
|
/*------ Main Screen routines ------------------------------------------*/
|
||||||
//atic void do_key (unsigned c);
|
//atic void do_key (unsigned c);
|
||||||
//atic void summaryhlp (CPUS_t *cpu, const char *pfx);
|
//atic void summaryhlp (CPUS_t *cpu, const char *pfx);
|
||||||
//atic proc_t **summary_show (void);
|
//atic proc_t **summary_show (void);
|
||||||
//atic void taskhlp (WIN_t *q, int a, int c, int *p, char *b, const char *f, ...);
|
//atic void task_show (WIN_t *q, proc_t *p);
|
||||||
//atic void task_show (WIN_t *q, proc_t *task);
|
//atic void window_show (proc_t **ppt, WIN_t *q, int *lscr);
|
||||||
//atic void window_show (proc_t **ppt, WIN_t *q, int *lscr);
|
|
||||||
/*------ Entry point plus two ------------------------------------------*/
|
/*------ Entry point plus two ------------------------------------------*/
|
||||||
//atic void framehlp (int wix, int max);
|
//atic void framehlp (int wix, int max);
|
||||||
//atic void frame_make (void);
|
//atic void frame_make (void);
|
||||||
// int main (int dont_care_argc, char **argv);
|
// int main (int dont_care_argc, char **argv);
|
||||||
|
|
||||||
/* just sanity check(s)... */
|
/* just sanity check(s)... */
|
||||||
#if USRNAMSIZ < GETBUFSIZ
|
#if USRNAMSIZ < GETBUFSIZ
|
||||||
#error "Jeeze, USRNAMSIZ Must NOT be less than GETBUFSIZ !"
|
# error "Jeeze, USRNAMSIZ Must NOT be less than GETBUFSIZ !"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _Itop */
|
#endif /* _Itop */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user