From e3dd77d43978740e74f444138ace0f702f7c9ad2 Mon Sep 17 00:00:00 2001 From: albert <> Date: Thu, 3 Oct 2002 21:10:50 +0000 Subject: [PATCH] top: man page tabs and such, go faster, quit w/ q --- top.1 | 116 ++++++++++++++++++++++++++++------------------------------ top.c | 11 ++---- top.h | 8 +--- 3 files changed, 61 insertions(+), 74 deletions(-) diff --git a/top.1 b/top.1 index b1b7ccee..51a5dff4 100644 --- a/top.1 +++ b/top.1 @@ -7,7 +7,7 @@ . any later version published by the Free Software Foundation; . with no Front-Cover Texts, no Back-Cover Texts, and with the following . Invariant Sections (and any sub-sections therein): -. this .ig-section +. all .ig sections, including this one . DIFFERENCES / New Features . STUPID TRICKS Sampler . NOTES and Rantings @@ -25,86 +25,86 @@ \# ** Comment out '.nr' or set to 0 to eliminate WIDTH fiddlin' ! .nr half_xtra 4 . -. ll +(\n[half_xtra] + \n[half_xtra]) +.ll +(\n[half_xtra] + \n[half_xtra]) . \# Special right justify macros --------------------- -\# - right justify start -. de Rjb -. ll -\n[half_xtra] -. rj \\$1 +\# - right justify begin +.de Rjb +.ll -\n[half_xtra] +.rj \\$1 .. \# - right justify end -. de Rje -. ll +\n[half_xtra] +.de Rje +.ll +\n[half_xtra] .. \# Jimmy's darn Bullet style ------------------------ -. de Jbu -. IP "-" 3 +.de Jbu +.IP "-" 3 .. \# - bullet continuation paragraph -. de Jp -. IP "" 3 +.de Jp +.IP "" 3 .. \# New features/differences style ------------------- -. de New -. IP "-*-" 5 +.de New +.IP "-*-" 5 .. \# Screen image style ------------------------------- -. de Img -. IP "" -4 -. Rjb 26 +.de Img +.IP "" -4 +.Rjb 26 .. \# Code image style --------------------------------- -. de ImgC -. IP "" -4 -. Rjb 20 +.de ImgC +.IP "" -4 +.Rjb 20 .. \# Screen narrative (wide narrative) style ---------- -. de Scr +.de Scr .PP -. in -4 +.in -4 .. \# Special emphasis --------------------------------- -. de Zzz -. ce +.de Zzz +.ce -*- -*- -*- .. . \# Commonly used strings (for consistency) ---------- \# - a real em-dash, darn-it -. ds EM \ \fB\-\-\ \fR +.ds EM \ \fB\-\-\ \fR \# - these two are for chuckles, makes great grammar -. ds Me top -. ds ME \fBtop\fR +.ds Me top +.ds ME \fBtop\fR \# - hey, these two ain't too shabby, either -. ds Us this\ \*(Me -. ds US \fBthis\fR\ \*(Me +.ds Us this\ \*(Me +.ds US \fBthis\fR\ \*(Me \# - other misc strings for consistent usage/emphasis -. ds F \fIOff\fR -. ds O \fIOn\fR +.ds F \fIOff\fR +.ds O \fIOn\fR . -. ds AM alternate\-display mode -. ds AS asterisk ('*') -. ds CF configuration file -. ds CI interactive command -. ds CO command\-line option -. ds CW \'current' window -. ds FM full\-screen mode -. ds MP \fBphysical\fR memory -. ds MS \fBshared\fR memory -. ds MV \fBvirtual\fR memory -. ds NT \fBNote\fR: -. ds PU CPU -. ds Pu cpu -. ds SA summary area -. ds TA task area -. ds TD task display -. ds TW task window +.ds AM alternate\-display mode +.ds AS asterisk ('*') +.ds CF configuration file +.ds CI interactive command +.ds CO command\-line option +.ds CW \'current' window +.ds FM full\-screen mode +.ds MP \fBphysical\fR memory +.ds MS \fBshared\fR memory +.ds MV \fBvirtual\fR memory +.ds NT \fBNote\fR: +.ds PU CPU +.ds Pu cpu +.ds SA summary area +.ds TA task area +.ds TD task display +.ds TW task window \# - xref's that depend on commands or topic names -. ds XC See the -. ds Xc see the -. ds XT See topic -. ds Xt see topic +.ds XC See the +.ds Xc see the +.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 \*(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 @@ -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. 3a.\fI GLOBAL_Commands\fR - , ?, =, A, d, G, h, I, k, Q, r, s, W, Z + , ?, =, A, d, G, h, I, k, q, r, s, W, Z 3b.\fI SUMMARY_Area_Commands\fR l, m, t, 1 3c.\fI TASK_Area_Commands\fR @@ -894,11 +894,7 @@ depending on your progress: 2) at the\fB signal\fR prompt, type 0 .TP 7 -\ \ \'\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. +\ \ \'\fBq\fR\' :\fIQuit\fR .TP 7 *\ \'\fBr\fR\' :\fIRenice_a_Task\fR @@ -1982,7 +1978,7 @@ AUTHOR .in A copy of the license is included in the section entitled \(dqGNU Free Documentation License\(dq. -. CCend +.CCend . .\" end: active doc |||||||||||||||||||||||||||||||||||||||||||||||||| .\" |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| diff --git a/top.c b/top.c index dafa4f3c..f95a9ece 100644 --- a/top.c +++ b/top.c @@ -732,11 +732,12 @@ static char *scale_tics (TICS_t tics, const unsigned width) unsigned i, t; /* try successively higher units until it fits */ - t = tics / Hertz; + t = (tics * 100) / (TICS_t)Hertz; 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) return buf; + t /= 100; sprintf(buf, "%u:%02u", t / 60, t % 60); /* minutes:seconds */ 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 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 in Solaris mode, adjust cpu percentage not only for the cpu the process is running on, but for all cpus together */ @@ -2276,11 +2277,7 @@ static void do_key (unsigned c) } break; -#ifdef QUIT_NORMALQ case 'q': -#else - case 'Q': -#endif stop(0); case 'r': diff --git a/top.h b/top.h index 2079639f..eb2d8cbe 100644 --- a/top.h +++ b/top.h @@ -28,7 +28,6 @@ //#define CASEUP_SCALE /* show scaled time/num suffix upper case */ //#define CASEUP_SUMMK /* show memory summary kilobytes with 'K' */ //#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 TICS_64_BITS /* accommodate Linux 2.5.xx 64-bit jiffies */ //#define UNEQUAL_SORT /* use pid's as a secondary sort key */ @@ -350,11 +349,6 @@ typedef struct win { /* Keyboard Help specially formatted string(s) -- see 'show_special' for syntax details + other cautions. */ -#ifdef QUIT_NORMALQ -#define HELP_Qkey " q " -#else -#define HELP_Qkey " Q " -#endif #define KEYS_help \ "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" \ @@ -375,7 +369,7 @@ typedef struct win { "\n" \ "%s" \ " W Write configuration file\n" \ - HELP_Qkey "Quit\n" \ + " q Quit\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" \ "any other key to continue " \ -- 2.40.0