Synched top.[ch1] to Jims Wg release
This commit is contained in:
parent
52b97b8d3f
commit
d32861b68f
96
top.1
96
top.1
@ -22,20 +22,20 @@
|
||||
.igEND
|
||||
.
|
||||
.\" Setup ////////////////////////////////////////////////////////////////
|
||||
. \" ** Comment out 'll' to eliminate WIDTH fiddlin', 1 of 3
|
||||
. ll +8
|
||||
\# ** Comment out '.nr' or set to 0 to eliminate WIDTH fiddlin' !
|
||||
.nr half_xtra 4
|
||||
.
|
||||
. ll +(\n[half_xtra] + \n[half_xtra])
|
||||
.
|
||||
\# Special right justify macros ---------------------
|
||||
\# - right justify start
|
||||
. de Rjb
|
||||
. \" ** Comment out 'll' to eliminate WIDTH fiddlin', 2 of 3
|
||||
. ll -4
|
||||
. ll -\n[half_xtra]
|
||||
. rj \\$1
|
||||
..
|
||||
\# - right justify end
|
||||
. de Rje
|
||||
. \" ** Comment out 'll' to eliminate WIDTH fiddlin', 3 of 3
|
||||
. ll +4
|
||||
. ll +\n[half_xtra]
|
||||
..
|
||||
\# Jimmy's darn Bullet style ------------------------
|
||||
. de Jbu
|
||||
@ -225,7 +225,7 @@ columns get misaligned.
|
||||
personal \*(CF, including any changes made on a per-window basis.
|
||||
Thus, once you personalize things they\fB remain personalized\fR until
|
||||
you decide to change them again.
|
||||
This \*(ME has been completely cured of:
|
||||
This \*(Me has been completely cured of:
|
||||
.Rjb 2
|
||||
i-cant-remember-so-please-do-that-all-over-again
|
||||
( and again, and again ... )
|
||||
@ -239,14 +239,13 @@ go bye-bye.
|
||||
|
||||
.New
|
||||
You have complete program\fB naming freedom\fR with no internal ties to a
|
||||
specific \*(CF.
|
||||
Thus, if you have permission to create symbolic links to /usr/bin (or can bribe
|
||||
the system administrator), these symlinks could be used to establish\fB
|
||||
different\fR \*(CFs reflecting the different\fB personalities\fR of your
|
||||
customized "\*(Mes", under whatever aliases you've used.
|
||||
specific personal \*(CF.
|
||||
Symbolic links could be used to establish different \*(CFs reflecting
|
||||
the different personalities of your customized "\*(Mes", under whatever
|
||||
aliases you've used.
|
||||
|
||||
Thus, you could have an alias for running \*(Me in 'Batch mode', another for when
|
||||
you work from the Linux console and maybe a third used with X-Windows.
|
||||
Thus, you could have an alias for running \*(Me in 'Batch mode', another for
|
||||
when you work from the Linux console and maybe a third used with X-Windows.
|
||||
All of that, yet still just a single binary image!
|
||||
|
||||
.\" ......................................................................
|
||||
@ -289,7 +288,7 @@ more distinct).
|
||||
|
||||
.I Columns_Header\fR:
|
||||
Shows a\fB new\fR field and some\fB changed\fR labels (unseen to the right).
|
||||
Precious horizontal space is no longer squandered unlike your former top.
|
||||
Precious horizontal space is no longer squandered.
|
||||
|
||||
.Scr
|
||||
All of that, however, is just the tip of the old iceberg.
|
||||
@ -333,7 +332,7 @@ assuming no \*(CF, thus no user customizations.
|
||||
However, items shown with an \*(AS could be overridden through the\fB
|
||||
command line\fR \*(EM a subject soon to be dealt with.
|
||||
|
||||
\fISystem_defaults\fR
|
||||
\fIGlobal_defaults\fR
|
||||
'A' - Alt display \fBOff\fR (full-screen)
|
||||
* 'd' - Delay time 3.0 seconds
|
||||
'I' - Irix mode On\ \ (no, 'solaris' smp)
|
||||
@ -362,7 +361,7 @@ for a successful\fB close-encounter-of-the-1st-kind\fR with \*(Us.
|
||||
You need remember just the\fB help key\fR ('h' or '?') to survive
|
||||
\*(EM nay, prosper!
|
||||
What about quitting, you ask?
|
||||
Well, of course there's the 'Q' \*(CI, but then \*(ME does quite well
|
||||
Well, of course there's the 'Q' \*(CI, but then \*(Me does quite well
|
||||
with\fB signals\fR.
|
||||
So just zap him with the traditional \fI^C\fR when you're done.
|
||||
.br
|
||||
@ -746,8 +745,8 @@ then be\fB shown\fR as part of the \*(TD (screen width permitting).
|
||||
This will also be indicated by a leading \*(AS, as in this excerpt:
|
||||
\fR...
|
||||
\fR* J: %CPU = CPU usage
|
||||
\fR K: TIME = CPU Time
|
||||
\fR L: TIME+ = CPU Time, hundredths
|
||||
\fR k: TIME = CPU Time
|
||||
\fR l: TIME+ = CPU Time, hundredths
|
||||
\fR* M: %MEM = Memory usage (RES)
|
||||
\fR* N: VIRT = Virtual Image (kb)
|
||||
\fR...
|
||||
@ -768,8 +767,8 @@ letter.
|
||||
.SH 3. INTERACTIVE Commands
|
||||
.\" ----------------------------------------------------------------------
|
||||
Listed below is a brief index of commands within categories.
|
||||
Some commands appear more than once and, while their meaning is consistent,
|
||||
the scope may vary depending on the context in which they are issued.
|
||||
Some commands appear more than once \*(EM their meaning or scope may vary
|
||||
depending on the context in which they are issued.
|
||||
|
||||
3a.\fI GLOBAL_Commands\fR
|
||||
?, ^L, <Sp>, =, A, d, F, h, O, I, k, Q, r, s, W, Z
|
||||
@ -783,7 +782,7 @@ the scope may vary depending on the context in which they are issued.
|
||||
3d.\fI COLOR_Mapping\fR
|
||||
<Enter>, a, b, H, M, q, S, T, w, z, 0 - 7
|
||||
4b.\fI COMMANDS_for_Windows\fR
|
||||
-, _, =, +, A, F, g, O
|
||||
-, _, =, +, A, a, F, g, O, w
|
||||
|
||||
.\" ......................................................................
|
||||
.SS 3a. GLOBAL Commands
|
||||
@ -827,8 +826,9 @@ When operating in \*(AM this command has a slightly broader meaning.
|
||||
|
||||
.TP 7
|
||||
\ \ \'\fBA\fR\' :\fIAlternate_Display_Mode_toggle\fR
|
||||
This command will switch between \*(FM and \*(AM
|
||||
(see 4. ALTERNATE\-DISPLAY Mode).
|
||||
This command will switch between \*(FM and \*(AM.
|
||||
See 4. ALTERNATE\-DISPLAY Mode and the 'F' or 'O' \*(CIs for insight into
|
||||
\*(CWs and field groups.
|
||||
|
||||
.TP 7
|
||||
*\ \'\fBd\fR\' or \'\fBs\fR\' :\fIChange_Delay_Time_interval\fR
|
||||
@ -936,8 +936,8 @@ When you see 'Cpu(s) state:' in the \*(SA, the '1' toggle is \*O and all
|
||||
Otherwise, each \*(Pu is displayed separately as: 'cpu0, cpu1, ...'
|
||||
|
||||
.in +4
|
||||
\*(NT If you receive a fatal error message in response to this command,
|
||||
your version of the kernel does not provide summary \*(Pu data in '/proc/stat'.
|
||||
\*(NT If you receive a fatal error message in response to this command, your
|
||||
version of the kernel does not provide separate \*(Pu data in '/proc/stat'.
|
||||
You can either avoid issuing this command or recompile \*(Me with the
|
||||
appropriate #define enabled so the command will be restricted to SMP.
|
||||
.in
|
||||
@ -985,7 +985,8 @@ your-brand-new-top and you'll make the program author a happy guy.
|
||||
\ \ \'\fBz\fR\' :\fIColor/Monochrome_toggle\fR
|
||||
Switches the \*(CW between your last used color scheme and the older form
|
||||
of black-on-white or white-on-black.
|
||||
It does not affect the state of the 'x', 'y' or 'b' toggles.
|
||||
This command will alter both the \*(SA and \*(TA but does not affect the
|
||||
state of the 'x', 'y' or 'b' toggles.
|
||||
|
||||
.PP
|
||||
.\" .........................
|
||||
@ -1066,21 +1067,26 @@ Lose no sleep over 'reverse' and 'normal', ok?
|
||||
|
||||
.TP 7
|
||||
\ \ \fB\ 7\fR\ \ upper case letters which \fISelect_a_Sort_Column\fR:
|
||||
\'C\fR\'\ \ :Sort by Command\fB line\fR or program\fB name\fR,
|
||||
\'\fBC\fR\'\ \ :Sort by Command\fB line\fR or program\fB name\fR,
|
||||
.br
|
||||
\ \ \ \ \ \ depending on the state of the 'c' toggle
|
||||
.br
|
||||
\'E\'\ \ :Sort by USER
|
||||
\'\fBE\fR\'\ \ :Sort by USER
|
||||
.br
|
||||
\'M\'\ \ :Sort by %MEM and/or RES
|
||||
\'\fBM\fR\'\ \ :Sort by %MEM and/or RES
|
||||
.br
|
||||
\'P\'\ \ :Sort by PID
|
||||
\'\fBP\fR\'\ \ :Sort by PID
|
||||
.br
|
||||
\'T\'\ \ :Sort by TIME and/or TIME+
|
||||
\'\fBT\fR\'\ \ :Sort by TIME and/or TIME+
|
||||
.br
|
||||
\'U\'\ \ :Sort by %CPU
|
||||
\'\fBU\fR\'\ \ :Sort by %CPU
|
||||
.br
|
||||
\'Y\'\ \ :Sort by TTY
|
||||
\'\fBY\fR\'\ \ :Sort by TTY
|
||||
|
||||
.PP
|
||||
If you forget which field \*(Me is sorting, the '\fBR\fR' or '\fBx\fR'
|
||||
\*(CIs could be used for a quick visual reminder, without changing the
|
||||
selected sort column.
|
||||
|
||||
.\" ......................................................................
|
||||
.SS 3d. COLOR Mapping
|
||||
@ -1196,9 +1202,10 @@ Come on, let's hear it, who ya gonna' blame, huh?
|
||||
.TP 7
|
||||
\ \ \'\fB-\fR\' or \'\fB_\fR\' :\fIShow/Hide_Window(s)_toggle\fR
|
||||
The '-' (minus) key turns the \*(CW's \*(TD \*O and \*F.
|
||||
When \*O, that \*(TA will show a minimum of 1 task and the columns header
|
||||
you've established with the 'f' and 'o' commands.
|
||||
It will also reflect any other \*(TA options/toggles you've applied.
|
||||
When \*O, that \*(TA will show a minimum of the columns header you've
|
||||
established with the 'f' and 'o' commands.
|
||||
It will also reflect any other \*(TA options/toggles you've applied yielding
|
||||
zero or more tasks.
|
||||
|
||||
The '_' (upper case minus) key does the same for\fB all\fR \*(TDs.
|
||||
In other words, it switches between the currently visible \*(TD(s) and any
|
||||
@ -1403,7 +1410,7 @@ empty rows...
|
||||
.Img
|
||||
1:Def\fI no\fR highlight, +\fB--------------------------------------\fR+
|
||||
thus disabled cmds: |1:Def - 15:50:32 up 16:29, 9 users, :
|
||||
b,i,n,u,x,y,z, etc. |Tasks: \fB 75\fR total, \fB 2\fR running, \fB 73\fR sle:
|
||||
b,i,n,u,x,y, etc. |Tasks: \fB 75\fR total, \fB 2\fR running, \fB 73\fR sle:
|
||||
& m = lost Mem/Swap |Cpu(s) state: \fB 10.6%\fR user, \fB 0.0%\fR syst:
|
||||
|______________________________________:
|
||||
2:Job was very busy: |\fI2__PID__PPID_Command____________TIME+_\fR:
|
||||
@ -1471,15 +1478,14 @@ not successfully, ha ha):
|
||||
\fBs\fR or\fB d\fR Change\fB delay/update\fR interval
|
||||
|
||||
The system \*(CF is\fB not\fR created by \*(Me.
|
||||
Rather,\fB you create this file manually\fR and place it in the\fI /etc\fR directory.
|
||||
Its name must agree with 'your-name-for-top'\ +\ 'rc' and must have\fI
|
||||
no\fR leading '.' (period).
|
||||
It must have\fI only_two_lines\fR.
|
||||
Rather,\fB you create this file manually\fR and place it in the \fI/etc\fR
|
||||
directory.
|
||||
Its name must be 'toprc' and must have\fI no\fR leading '.' (period).
|
||||
It must have only\fI two lines\fR.
|
||||
|
||||
Here is an example of a system \*(CF placed in\fI /etc\fR
|
||||
as\fI top\fBrc\fR:\ \ /etc/\fItop\fBrc\fR
|
||||
Here is an example of the contents of\fI /etc/toprc\fR:
|
||||
\fBs\fR # line 1: 'secure' mode switch
|
||||
\fB5.0\fR # line 2: 'delay'\ \ interval (secs)
|
||||
\fB5.0\fR # line 2: 'delay'\ \ interval in seconds
|
||||
|
||||
.\" ......................................................................
|
||||
.SS 5b. PERSONAL Configuration File
|
||||
|
76
top.c
76
top.c
@ -72,12 +72,11 @@ static struct termios Savedtty,
|
||||
Rawtty;
|
||||
static int Ttychanged = 0;
|
||||
|
||||
/* Program name used in error messages and 'rc' file names */
|
||||
/* Program name used in error messages and local 'rc' file name */
|
||||
static char *Myname;
|
||||
|
||||
/* The Name of the config file(s), dynamically constructed */
|
||||
static char RCfile [OURPATHSZ],
|
||||
RCfile_Sys [SMLBUFSIZ];
|
||||
/* The Name of the local config file, dynamically constructed */
|
||||
static char RCfile [OURPATHSZ];
|
||||
|
||||
/* The run-time acquired page size */
|
||||
static int Page_size;
|
||||
@ -380,7 +379,11 @@ static void bye_bye (int eno, const char *str)
|
||||
"\nbye_bye's Summary report:"
|
||||
"\n\tProgram"
|
||||
"\n\t Page_size = %d, Cpu_tot = %d"
|
||||
"\n\tTerminal: %s"
|
||||
"\n\t %s, Hertz = %u (size %u bytes, %u-bit time)"
|
||||
"\n\t sizeof(CPUS_t) = %u, sizeof(HIST_t) = %u (%u HIST_t's/Page)"
|
||||
"\n\t CPU_FMTS_JUST1 = %s"
|
||||
" \t CPU_FMTS_MULTI = %s"
|
||||
" \tTerminal: %s"
|
||||
"\n\t device = %s, ncurses = v%s"
|
||||
"\n\t max_colors = %d, max_pairs = %d"
|
||||
"\n\t Cap_can_goto = %s"
|
||||
@ -388,7 +391,7 @@ static void bye_bye (int eno, const char *str)
|
||||
"\n\t Max_lines = %d"
|
||||
"\n\tWindows and Curwin->"
|
||||
"\n\t sizeof(WIN_t) = %u, GROUPSMAX = %d"
|
||||
"\n\t winname = %s, grpname = %s,"
|
||||
"\n\t winname = %s, grpname = %s"
|
||||
#ifdef CASEUP_HEXES
|
||||
"\n\t winflags = %08X, maxpflgs = %d"
|
||||
#else
|
||||
@ -399,6 +402,9 @@ static void bye_bye (int eno, const char *str)
|
||||
"\n\t sorttype = %c"
|
||||
"\n"
|
||||
, Page_size, Cpu_tot
|
||||
, procps_version, (unsigned)Hertz, sizeof(Hertz), sizeof(Hertz) * 8
|
||||
, sizeof(CPUS_t), sizeof(HIST_t), Page_size / sizeof(HIST_t)
|
||||
, CPU_FMTS_JUST1, CPU_FMTS_MULTI
|
||||
#ifdef PRETENDNOCAP
|
||||
, "dumb"
|
||||
#else
|
||||
@ -787,12 +793,12 @@ static char *scale_tics (TICS_t tics, const unsigned width)
|
||||
|
||||
/* try successively higher units until it fits */
|
||||
t = tics / Hertz;
|
||||
sprintf(buf, "%d:%02d.%02d" /* minutes:seconds.tenths */
|
||||
, t/60, t%60, (int)((tics*100)/Hertz)%100);
|
||||
sprintf(buf, "%u:%02u.%02u" /* minutes:seconds.hundredths */
|
||||
, t/60, t%60, (unsigned)((tics*100)/Hertz)%100);
|
||||
if (strlen(buf) <= width)
|
||||
return buf;
|
||||
|
||||
sprintf(buf, "%d:%02d", t/60, t%60); /* minutes:seconds */
|
||||
sprintf(buf, "%u:%02u", t/60, t%60); /* minutes:seconds */
|
||||
if (strlen(buf) <= width)
|
||||
return buf;
|
||||
|
||||
@ -944,8 +950,8 @@ static void before (char *me)
|
||||
|
||||
|
||||
/*
|
||||
* Build the two RC file names then try to read 'em. */
|
||||
/* '/etc/RCfile_Sys' contains two lines consisting of the secure
|
||||
* Build the local RC file name then try to read both of 'em. */
|
||||
/* 'SYS_RCFILE' contains two lines consisting of the secure
|
||||
* mode switch and an update interval. It's presence limits what
|
||||
* ordinary users are allowed to do. */
|
||||
/* '$HOME/RCfile' contains multiple lines - 2 global + 3 per window.
|
||||
@ -966,12 +972,11 @@ static void configs_read (void)
|
||||
char id;
|
||||
int i;
|
||||
|
||||
strcpy(RCfile_Sys, fmtmk("/etc/%src", Myname));
|
||||
if (getenv("HOME"))
|
||||
strcpy(RCfile, fmtmk("%s%c", getenv("HOME"), '/'));
|
||||
strcat(RCfile, fmtmk(".%src", Myname));
|
||||
|
||||
fp = fopen(RCfile_Sys, "r");
|
||||
fp = fopen(SYS_RCFILE, "r");
|
||||
if (fp) {
|
||||
fbuf[0] = '\0';
|
||||
fgets(fbuf, sizeof(fbuf), fp); /* sys rc file, line #1 */
|
||||
@ -1079,7 +1084,7 @@ static void parse_args (char **args)
|
||||
if (cp[1]) cp++;
|
||||
else if (*args) cp = *args++;
|
||||
else std_err("-n requires argument");
|
||||
if (1 != sscanf(cp, "%d", &Loops) || 0 > Loops)
|
||||
if (1 != sscanf(cp, "%d", &Loops) || 1 > Loops)
|
||||
std_err(fmtmk("bad iterations arg '%s'", cp));
|
||||
break;
|
||||
case 'p':
|
||||
@ -1113,7 +1118,7 @@ static void parse_args (char **args)
|
||||
} /* end: switch (*cp) */
|
||||
|
||||
/* advance cp and jump over any numerical args used above */
|
||||
if (*cp) cp += strspn(++cp, "- ,.1234567890");
|
||||
if (*cp) cp += strspn(&cp[1], "- ,.1234567890") + 1;
|
||||
} /* end: while (*cp) */
|
||||
} /* end: while (*args) */
|
||||
|
||||
@ -1184,13 +1189,15 @@ static void display_fields (void)
|
||||
too lazy to handle his own asterisk (*) logic */
|
||||
putp(Cap_bold);
|
||||
for (i = 0; i < MAXtbl(Fieldstab); ++i) {
|
||||
int b = (NULL != strchr(Curwin->fieldscur, i + 'A'));
|
||||
/* advance past any leading spaces */
|
||||
for (p = Fieldstab[i].head; ' ' == *p; ++p)
|
||||
;
|
||||
|
||||
printf("%s%c %c: %-10s = %s"
|
||||
, tg2((i / rmax) * cmax, (i % rmax) + yRSVD)
|
||||
, strchr(Curwin->fieldscur, i + 'A') ? '*' : ' '
|
||||
, i + 'A'
|
||||
, b ? '*' : ' '
|
||||
, b ? i + 'A' : i + 'a'
|
||||
, p
|
||||
, Fieldstab[i].desc);
|
||||
}
|
||||
@ -1670,9 +1677,9 @@ static void cpudo (FILE *fp, const char *fmt, CPUS_t *cpu, const char *pfx)
|
||||
{
|
||||
/* we'll trim to zero if we get negative time ticks,
|
||||
which has happened with some SMP kernels (pre-2.4?) */
|
||||
#define TRIMz(x) ((tz = (long)x) < 0 ? 0 : tz)
|
||||
#define TRIMz(x) ((tz = (STIC_t)x) < 0 ? 0 : tz)
|
||||
TICS_t u_tics, s_tics, n_tics, i_tics;
|
||||
long u_frme, s_frme, n_frme, i_frme, tot_frme, tz;
|
||||
STIC_t u_frme, s_frme, n_frme, i_frme, tot_frme, tz;
|
||||
|
||||
#ifdef PRETEND4CPUS
|
||||
rewind(fp);
|
||||
@ -1696,6 +1703,7 @@ static void cpudo (FILE *fp, const char *fmt, CPUS_t *cpu, const char *pfx)
|
||||
, (float)s_frme * 100 / tot_frme
|
||||
, (float)n_frme * 100 / tot_frme
|
||||
, (float)i_frme * 100 / tot_frme));
|
||||
Msg_row += 1;
|
||||
|
||||
/* remember for next time around */
|
||||
cpu->u = u_tics;
|
||||
@ -1716,7 +1724,6 @@ static void frame_states (proc_t **p, int show)
|
||||
{
|
||||
static HIST_t *hist_sav = NULL;
|
||||
static unsigned hist_siz;
|
||||
static int viewsav;
|
||||
static CPUS_t *smpcpu;
|
||||
HIST_t *hist_new;
|
||||
unsigned total, running, sleeping, stopped, zombie;
|
||||
@ -1725,14 +1732,12 @@ static void frame_states (proc_t **p, int show)
|
||||
|
||||
if (!hist_sav) {
|
||||
Frame_maxtask = 0;
|
||||
/* room for 512 HIST_t's (if Page_size == 4k) */
|
||||
hist_siz = (Page_size / sizeof(HIST_t));
|
||||
hist_sav = alloc_c(hist_siz);
|
||||
/* note: we allocate one more CPUS_t than Cpu_tot so that the last
|
||||
slot can hold tics representing the /proc/stat cpu summary
|
||||
(first line read) -- that slot supports summary cpu info */
|
||||
smpcpu = alloc_c((1 + Cpu_tot) * sizeof(CPUS_t));
|
||||
viewsav = CHKw(Curwin, View_CPUSUM);
|
||||
}
|
||||
hist_new = alloc_c(hist_siz);
|
||||
total = running = sleeping = stopped = zombie = 0;
|
||||
@ -1796,37 +1801,23 @@ static void frame_states (proc_t **p, int show)
|
||||
, total, running, sleeping, stopped, zombie));
|
||||
Msg_row += 1;
|
||||
|
||||
/* clean old histories if we've changed modes */
|
||||
if (CHKw(Curwin, View_CPUSUM) != viewsav) {
|
||||
if (CHKw(Curwin, View_CPUSUM))
|
||||
/* fresh start for the last slot in the history area */
|
||||
memset(&smpcpu[Cpu_tot], '\0', sizeof(CPUS_t));
|
||||
else
|
||||
/* fresh start for the true smpcpu history area */
|
||||
memset(smpcpu, '\0', Cpu_tot * sizeof(CPUS_t));
|
||||
viewsav = CHKw(Curwin, View_CPUSUM);
|
||||
}
|
||||
|
||||
if (!(fp = fopen("/proc/stat", "r")))
|
||||
std_err(fmtmk("Failed /proc/stat open: %s", strerror(errno)));
|
||||
|
||||
if (CHKw(Curwin, View_CPUSUM)) {
|
||||
/* retrieve and display just the 1st /proc/stat line */
|
||||
cpudo(fp, CPU_FMTS_JUST1, &smpcpu[Cpu_tot], "Cpu(s) state:");
|
||||
Msg_row += 1;
|
||||
} else {
|
||||
char tmp[SMLBUFSIZ];
|
||||
|
||||
/* skip the 1st line, which reflects total cpu states */
|
||||
if (!fgets(tmp, sizeof(tmp), fp))
|
||||
std_err("Failed /proc/stat read");
|
||||
if (!fgets(tmp, sizeof(tmp), fp)) std_err("Failed /proc/stat read");
|
||||
/* now do each cpu's states separately */
|
||||
for (i = 0; i < Cpu_tot; i++) {
|
||||
sprintf(tmp, "%-6scpu%-2d:" /* [ cpu states as ] */
|
||||
, i ? " " : "State" /* 'State cpu0 : ... ' */
|
||||
, Mode_irixps ? i : Cpu_map[i]); /* ' cpu1 : ... ' */
|
||||
cpudo(fp, CPU_FMTS_MULTI, &smpcpu[i], tmp);
|
||||
Msg_row += 1;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
@ -2168,7 +2159,7 @@ static void do_key (unsigned c)
|
||||
case 'g':
|
||||
if (Mode_altscr) {
|
||||
char tmp[GETBUFSIZ];
|
||||
strcpy(tmp, ask4str(fmtmk("Rename window '%s' to (0-3 chars)"
|
||||
strcpy(tmp, ask4str(fmtmk("Rename window '%s' to (1-3 chars)"
|
||||
, Curwin->winname)));
|
||||
if (tmp[0]) win_names(Curwin, tmp);
|
||||
}
|
||||
@ -2319,7 +2310,7 @@ static void do_key (unsigned c)
|
||||
fprintf(fp, "RCfile for \"%s with windows\"\t\t# shameless braggin'\n"
|
||||
, Myname);
|
||||
fprintf(fp, "Id:%c, "
|
||||
"Mode_altscr=%d, Mode_irixps=%d, Delay_time=%.1f, Curwin=%d\n"
|
||||
"Mode_altscr=%d, Mode_irixps=%d, Delay_time=%.3f, Curwin=%d\n"
|
||||
, RCF_FILEID
|
||||
, Mode_altscr, Mode_irixps, Delay_time, Curwin - Winstk[0]);
|
||||
for (i = 0; i < GROUPSMAX; i++) {
|
||||
@ -2553,7 +2544,7 @@ static void do_window (proc_t **ppt, WIN_t *q, int *lscr)
|
||||
* -- i swear that's the whole truth, so-help-me ! */
|
||||
static void sohelpme (int wix, int max)
|
||||
{
|
||||
WIN_t *w;
|
||||
WIN_t *w = Winstk[wix];
|
||||
int i, rsvd, size, wins;
|
||||
|
||||
/* calc remaining number of visible windows + total 'user' lines */
|
||||
@ -2656,7 +2647,9 @@ static void so_lets_see_em (void)
|
||||
* it just SPLENDIDLY! You go right on doing it EXACTLY the SAME!
|
||||
*/
|
||||
int main (int dont_care_argc, char **argv)
|
||||
{ /*
|
||||
{
|
||||
before(*argv);
|
||||
/*
|
||||
Ok, she's gone now. Don't you mind her, she means well but yes, she is
|
||||
a bit of a busy-body. Always playing the matchmaker role, trying to do
|
||||
away with unmarried windows and bachelors. So, back to business buddy!
|
||||
@ -2668,7 +2661,6 @@ int main (int dont_care_argc, char **argv)
|
||||
Well then, here, try THIS sandwich...
|
||||
+-------------+ */
|
||||
windows_stage1(); /* top (sic) slice */
|
||||
before(*argv); /* > seasonings, < */
|
||||
configs_read(); /* > spread etc, < */
|
||||
parse_args(&argv[1]); /* > lean stuff, < */
|
||||
whack_terminal(); /* > onions etc. < */
|
||||
|
30
top.h
30
top.h
@ -25,10 +25,11 @@
|
||||
|
||||
/* Defines intended to be experimented with ------------------------ */
|
||||
//#define CASEUP_HEXES /* show any hex values in upper case */
|
||||
//#define CASEUP_SCALE /* show scaled times & memory upper case */
|
||||
//#define CASEUP_SCALE /* show scaled time/num suffix upper case */
|
||||
//#define CASEUP_SUMMK /* show memory summary kilobytes with 'K' */
|
||||
//#define QUIT_NORMALQ /* use 'q' to quit, not new default 'Q' */
|
||||
//#define SORT_SUPRESS /* *attempt* to reduce qsort overhead */
|
||||
//#define TICS_64_BITS /* accommodate Linux 2.5.xx 64-bit jiffies */
|
||||
//#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 */
|
||||
|
||||
@ -101,8 +102,14 @@
|
||||
|
||||
/*###### Some Typedef's and Enum's #####################################*/
|
||||
|
||||
/* This typedef attempts to ensure consistent 'ticks' handling. */
|
||||
/* These typedefs attempt to ensure consistent 'ticks' handling */
|
||||
#ifdef TICS_64_BITS
|
||||
typedef unsigned long long TICS_t;
|
||||
typedef long long STIC_t;
|
||||
#else
|
||||
typedef unsigned long TICS_t;
|
||||
typedef long STIC_t;
|
||||
#endif
|
||||
|
||||
/* This structure consolidates the information that's used
|
||||
in a variety of display roles. */
|
||||
@ -257,8 +264,10 @@ typedef struct win {
|
||||
|
||||
/*###### Display Support *Data* ########################################*/
|
||||
|
||||
/* An rcfile 'footprint' used to invalidate existing */
|
||||
#define RCF_FILEID 'e'
|
||||
/* An rcfile 'footprint' used to invalidate existing local rcfile
|
||||
and the global rcfile path + name */
|
||||
#define RCF_FILEID 'g'
|
||||
#define SYS_RCFILE "/etc/toprc"
|
||||
|
||||
/* The default fields displayed and their order,
|
||||
if nothing is specified by the loser, oops user */
|
||||
@ -270,8 +279,13 @@ typedef struct win {
|
||||
|
||||
/* These are the possible fscanf formats used in /proc/stat
|
||||
reads during history processing. */
|
||||
#ifdef TICS_64_BITS
|
||||
#define CPU_FMTS_MULTI "cpu%*d %Lu %Lu %Lu %Lu\n"
|
||||
#define CPU_FMTS_JUST1 "cpu %Lu %Lu %Lu %Lu\n"
|
||||
#else
|
||||
#define CPU_FMTS_MULTI "cpu%*d %lu %lu %lu %lu\n"
|
||||
#define CPU_FMTS_JUST1 "cpu %lu %lu %lu %lu\n"
|
||||
#endif
|
||||
|
||||
/* Summary Lines specially formatted string(s) --
|
||||
see 'show_special' for syntax details + other cautions. */
|
||||
@ -338,8 +352,8 @@ typedef struct win {
|
||||
"%s's - \01Help for Interactive Commands\02 - %s\n" \
|
||||
"Window %s\06: \01Cumulative mode \03%s\02. \01System\06: \01Delay time \03%.1f secs\02; \01Secure mode \03%s\02.\n" \
|
||||
" sp or ^L Redraw screen\n" \
|
||||
" o Rearrange current window's fields\n" \
|
||||
" f Add and remove current window's fields\n" \
|
||||
" o . Rearrange current window's fields\n" \
|
||||
" f . Add and remove current window's fields\n" \
|
||||
" Z Change color mappings for any window\05\n" \
|
||||
"\n" \
|
||||
"(7 letters) . Sort: \01C\02) cmd; \01M\02) mem; \01P\02) pid; \01T\02) time; \01U\02) cpu; \01Y\02) tty; \01E\02) user\n" \
|
||||
@ -391,10 +405,6 @@ typedef struct win {
|
||||
" 0x00040000 PF_KERNTHREAD (2.5)\n" \
|
||||
" 0x00100000 PF_USEDFPU (thru 2.4)\n" \
|
||||
" 0x00400000 PF_ATOMICALLOC\n" \
|
||||
"\n" \
|
||||
"Memory notes:\n" \
|
||||
" VIRT = SWAP + RES\n" \
|
||||
" RES = CODE + DATA\n" \
|
||||
""
|
||||
|
||||
/* Windows/Field Group Help specially formatted string(s) --
|
||||
|
Loading…
Reference in New Issue
Block a user