top: man page tabs and such, go faster, quit w/ q

This commit is contained in:
albert 2002-10-03 21:10:50 +00:00
parent bc9cdacdcc
commit e3dd77d439
3 changed files with 61 additions and 74 deletions

116
top.1
View File

@ -7,7 +7,7 @@
. any later version published by the Free Software Foundation; . any later version published by the Free Software Foundation;
. with no Front-Cover Texts, no Back-Cover Texts, and with the following . with no Front-Cover Texts, no Back-Cover Texts, and with the following
. Invariant Sections (and any sub-sections therein): . Invariant Sections (and any sub-sections therein):
. this .ig-section . all .ig sections, including this one
. DIFFERENCES / New Features . DIFFERENCES / New Features
. STUPID TRICKS Sampler . STUPID TRICKS Sampler
. NOTES and Rantings . NOTES and Rantings
@ -25,86 +25,86 @@
\# ** Comment out '.nr' or set to 0 to eliminate WIDTH fiddlin' ! \# ** Comment out '.nr' or set to 0 to eliminate WIDTH fiddlin' !
.nr half_xtra 4 .nr half_xtra 4
. .
. ll +(\n[half_xtra] + \n[half_xtra]) .ll +(\n[half_xtra] + \n[half_xtra])
. .
\# Special right justify macros --------------------- \# Special right justify macros ---------------------
\# - right justify start \# - right justify begin
. de Rjb .de Rjb
. ll -\n[half_xtra] .ll -\n[half_xtra]
. rj \\$1 .rj \\$1
.. ..
\# - right justify end \# - right justify end
. de Rje .de Rje
. ll +\n[half_xtra] .ll +\n[half_xtra]
.. ..
\# Jimmy's darn Bullet style ------------------------ \# Jimmy's darn Bullet style ------------------------
. de Jbu .de Jbu
. IP "-" 3 .IP "-" 3
.. ..
\# - bullet continuation paragraph \# - bullet continuation paragraph
. de Jp .de Jp
. IP "" 3 .IP "" 3
.. ..
\# New features/differences style ------------------- \# New features/differences style -------------------
. de New .de New
. IP "-*-" 5 .IP "-*-" 5
.. ..
\# Screen image style ------------------------------- \# Screen image style -------------------------------
. de Img .de Img
. IP "" -4 .IP "" -4
. Rjb 26 .Rjb 26
.. ..
\# Code image style --------------------------------- \# Code image style ---------------------------------
. de ImgC .de ImgC
. IP "" -4 .IP "" -4
. Rjb 20 .Rjb 20
.. ..
\# Screen narrative (wide narrative) style ---------- \# Screen narrative (wide narrative) style ----------
. de Scr .de Scr
.PP .PP
. in -4 .in -4
.. ..
\# Special emphasis --------------------------------- \# Special emphasis ---------------------------------
. de Zzz .de Zzz
. ce .ce
-*- -*- -*- -*- -*- -*-
.. ..
. .
\# Commonly used strings (for consistency) ---------- \# Commonly used strings (for consistency) ----------
\# - a real em-dash, darn-it \# - a real em-dash, darn-it
. ds EM \ \fB\-\-\ \fR .ds EM \ \fB\-\-\ \fR
\# - these two are for chuckles, makes great grammar \# - these two are for chuckles, makes great grammar
. ds Me top .ds Me top
. ds ME \fBtop\fR .ds ME \fBtop\fR
\# - hey, these two ain't too shabby, either \# - hey, these two ain't too shabby, either
. ds Us this\ \*(Me .ds Us this\ \*(Me
. ds US \fBthis\fR\ \*(Me .ds US \fBthis\fR\ \*(Me
\# - other misc strings for consistent usage/emphasis \# - other misc strings for consistent usage/emphasis
. ds F \fIOff\fR .ds F \fIOff\fR
. ds O \fIOn\fR .ds O \fIOn\fR
. .
. ds AM alternate\-display mode .ds AM alternate\-display mode
. ds AS asterisk ('*') .ds AS asterisk ('*')
. ds CF configuration file .ds CF configuration file
. ds CI interactive command .ds CI interactive command
. ds CO command\-line option .ds CO command\-line option
. ds CW \'current' window .ds CW \'current' window
. ds FM full\-screen mode .ds FM full\-screen mode
. ds MP \fBphysical\fR memory .ds MP \fBphysical\fR memory
. ds MS \fBshared\fR memory .ds MS \fBshared\fR memory
. ds MV \fBvirtual\fR memory .ds MV \fBvirtual\fR memory
. ds NT \fBNote\fR: .ds NT \fBNote\fR:
. ds PU CPU .ds PU CPU
. ds Pu cpu .ds Pu cpu
. ds SA summary area .ds SA summary area
. ds TA task area .ds TA task area
. ds TD task display .ds TD task display
. ds TW task window .ds TW task window
\# - xref's that depend on commands or topic names \# - xref's that depend on commands or topic names
. ds XC See the .ds XC See the
. ds Xc see the .ds Xc see the
. ds XT See topic .ds XT See topic
. ds Xt see topic .ds Xt see topic
. .
.\" ////////////////////////////////////////////////////////////////////// .\" //////////////////////////////////////////////////////////////////////
.\" ---------------------------------------------------------------------- .\" ----------------------------------------------------------------------
@ -370,7 +370,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 You need remember just the\fB help key\fR ('h' or '?') to survive
\*(EM nay, prosper! \*(EM nay, prosper!
What about quitting, you ask? 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. with\fB signals\fR.
So just zap him with the traditional \fI^C\fR when you're done. So just zap him with the traditional \fI^C\fR when you're done.
.br .br
@ -794,7 +794,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, 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
@ -894,11 +894,7 @@ depending on your progress:
2) at the\fB signal\fR prompt, type 0 2) at the\fB signal\fR prompt, type 0
.TP 7 .TP 7
\ \ \'\fBQ\fR\' :\fIQuit\fR \ \ \'\fBq\fR\' :\fIQuit\fR
Please note that this is a capital \'Q' since the 'a' and 'w' keys will
probably be used frequently and they are adjacent to 'q'.
This \*(Me cares deeply for you and does not want you quitting ever \*(EM
make that accidentally.
.TP 7 .TP 7
*\ \'\fBr\fR\' :\fIRenice_a_Task\fR *\ \'\fBr\fR\' :\fIRenice_a_Task\fR
@ -1982,7 +1978,7 @@ AUTHOR
.in .in
A copy of the license is included in the section entitled A copy of the license is included in the section entitled
\(dqGNU Free Documentation License\(dq. \(dqGNU Free Documentation License\(dq.
. CCend .CCend
. .
.\" end: active doc |||||||||||||||||||||||||||||||||||||||||||||||||| .\" end: active doc ||||||||||||||||||||||||||||||||||||||||||||||||||
.\" |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| .\" ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

11
top.c
View File

@ -732,11 +732,12 @@ static char *scale_tics (TICS_t tics, const unsigned width)
unsigned i, t; unsigned i, t;
/* try successively higher units until it fits */ /* try successively higher units until it fits */
t = tics / Hertz; t = (tics * 100) / (TICS_t)Hertz;
sprintf(buf, "%u:%02u.%02u" /* mins:secs.hundredths */ sprintf(buf, "%u:%02u.%02u" /* mins:secs.hundredths */
, t / 60, t % 60, (unsigned)((tics * 100) / Hertz) % 100); , t / 6000, (t / 100) % 60, t % 100);
if (strlen(buf) <= width) if (strlen(buf) <= width)
return buf; return buf;
t /= 100;
sprintf(buf, "%u:%02u", t / 60, t % 60); /* minutes:seconds */ sprintf(buf, "%u:%02u", t / 60, t % 60); /* minutes:seconds */
if (strlen(buf) <= width) if (strlen(buf) <= width)
@ -1783,7 +1784,7 @@ static void frame_states (proc_t **ppt, int show)
} }
/* finally calculate an integer version of %cpu for this task /* finally calculate an integer version of %cpu for this task
and plug it into the unfilled slot in proc_t */ and plug it into the unfilled slot in proc_t */
this->pcpu = (tics * 1000 / Hertz) / etime; this->pcpu = (tics * 1000 / (TICS_t)Hertz) / etime;
if (this->pcpu > 999) this->pcpu = 999; if (this->pcpu > 999) this->pcpu = 999;
/* if in Solaris mode, adjust cpu percentage not only for the cpu /* if in Solaris mode, adjust cpu percentage not only for the cpu
the process is running on, but for all cpus together */ the process is running on, but for all cpus together */
@ -2276,11 +2277,7 @@ static void do_key (unsigned c)
} }
break; break;
#ifdef QUIT_NORMALQ
case 'q': case 'q':
#else
case 'Q':
#endif
stop(0); stop(0);
case 'r': case 'r':

8
top.h
View File

@ -28,7 +28,6 @@
//#define CASEUP_SCALE /* show scaled time/num suffix upper case */ //#define CASEUP_SCALE /* show scaled time/num suffix upper case */
//#define CASEUP_SUMMK /* show memory summary kilobytes with 'K' */ //#define CASEUP_SUMMK /* show memory summary kilobytes with 'K' */
//#define POSIX_CMDLIN /* use '[ ]' for kernel threads, not '( )' */ //#define POSIX_CMDLIN /* use '[ ]' for kernel threads, not '( )' */
//#define QUIT_NORMALQ /* use 'q' to quit, not new default 'Q' */
//#define SORT_SUPRESS /* *attempt* to reduce qsort overhead */ //#define SORT_SUPRESS /* *attempt* to reduce qsort overhead */
//#define TICS_64_BITS /* accommodate Linux 2.5.xx 64-bit jiffies */ //#define TICS_64_BITS /* accommodate Linux 2.5.xx 64-bit jiffies */
//#define UNEQUAL_SORT /* use pid's as a secondary sort key */ //#define UNEQUAL_SORT /* use pid's as a secondary sort key */
@ -350,11 +349,6 @@ typedef struct win {
/* Keyboard Help specially formatted string(s) -- /* Keyboard Help specially formatted string(s) --
see 'show_special' for syntax details + other cautions. */ see 'show_special' for syntax details + other cautions. */
#ifdef QUIT_NORMALQ
#define HELP_Qkey " q "
#else
#define HELP_Qkey " Q "
#endif
#define KEYS_help \ #define KEYS_help \
"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" \
@ -375,7 +369,7 @@ typedef struct win {
"\n" \ "\n" \
"%s" \ "%s" \
" W Write configuration file\n" \ " W Write configuration file\n" \
HELP_Qkey "Quit\n" \ " q Quit\n" \
" ( commands shown with '.' require a \01visible\02 task display \01window\02 ) \n" \ " ( commands shown with '.' require a \01visible\02 task display \01window\02 ) \n" \
"Press '\01h\02' or '\01?\02' for help with \01Windows\02,\n" \ "Press '\01h\02' or '\01?\02' for help with \01Windows\02,\n" \
"any other key to continue " \ "any other key to continue " \