top: for symmetry with 'E' add 'e' command line switch

Several years after the 'e' & 'E' interactive commands
were introduce to affect memory scaling, an 'E' switch
was added. This was after discovering a dropped Redhat
patch which provided a unique 'M' command line switch.

If only for symmetry it makes sense to offer a similar
command switch ('e') for the Task Area memory scaling.

As was true with 'E', top's help text will show 'e' as
if it were a switch without arguments in order to keep
help text displayed without wrap in an 80x24 terminal.
The man page, however, will show all of the arguments.

Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/165
. 03/2017, added 'E' command line switch
commit fb48b5d9fb
. 12/2012, added 'e' interactive command
commit 21e550bc08
. 12/2012, added 'E' interactive command
commit bc46f67f9a

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2020-03-29 00:00:00 -05:00 committed by Craig Small
parent d93609225c
commit f7dc5b1728
3 changed files with 29 additions and 7 deletions

View File

@ -25,8 +25,8 @@
.ds CI interactive command
\# - Note: our 'Command Line' used in 2 places
\# ( and managed to fit in an 80x24 terminal )
.ds CL \-\fBhv\fR|\-\fBbcEHiOSs1\fR \-\fBd\fR secs \-\fBn\fR max \
\-\fBu\fR|\fBU\fR user \-\fBp\fR pid \-\fBo\fR fld \-\fBw\fR [cols] \fR
.ds CL \-\fBhv\fR|\-\fBbcEeHiOSs1\fR \-\fBd\fR secs \-\fBn\fR max \
\-\fBu\fR|\fBU\fR user \-\fBp\fR pids \-\fBo\fR field \-\fBw\fR [cols] \fR
.ds CO command\-line option
.ds CT command toggle
.ds CW `current' window
@ -334,7 +334,20 @@ in Secure mode, except for root (unless the `s' \*(CO was used).
For additional information on Secure mode \*(Xt 6d. SYSTEM Restrictions File.
.TP 5
\-\fBE\fR\ \ :\fIExtend-Memory-Scaling\fR as:\ \ \fB-E k\fR | \fBm\fR | \fBg\fR | \fBt\fR | \fBp\fR | \fBe\fR
\-\fBe\fR\ \ :\fIEnforce-Task-Memory-Scaling\fR as:\ \ \fB-e k\fR | \fBm\fR | \fBg\fR | \fBt\fR | \fBp\fR
Instructs \*(We to force \*(TA memory to be scaled as:
.nf
k \- kibibytes
m \- mebibytes
g \- gibibytes
t \- tebibytes
p \- pebibytes
.fi
Later this can be changed with the `e' \*(CT.
.TP 5
\-\fBE\fR\ \ :\fIEnforce-Summary-Memory-Scaling\fR as:\ \ \fB-E k\fR | \fBm\fR | \fBg\fR | \fBt\fR | \fBp\fR | \fBe\fR
Instructs \*(We to force \*(SA memory to be scaled as:
.nf
k \- kibibytes
@ -1200,7 +1213,7 @@ If at any time you wish to know the current delay time, simply ask for
help and view the system summary on the second line.
.TP 7
\ \ \ \fBE\fR\ \ :\fIExtend-Memory-Scale\fR in Summary Area
\ \ \ \fBE\fR\ \ :\fIEnforce-Summary-Memory-Scale\fR in Summary Area
With this command you can cycle through the available \*(SA memory scaling
which ranges from KiB (kibibytes or 1,024 bytes) through EiB (exbibytes or
1,152,921,504,606,846,976 bytes).
@ -1210,8 +1223,8 @@ means that \*(We was forced to truncate some portion of that number.
By raising the scaling factor, such truncation can be avoided.
.TP 7
\ \ \ \fBe\fR\ \ :\fIExtend-Memory-Scale\fR in Task Windows
With this command you can cycle through the available \*(TW memory scaling
\ \ \ \fBe\fR\ \ :\fIEnforce-Task-Memory-Scale\fR in Task Area
With this command you can cycle through the available \*(TA memory scaling
which ranges from KiB (kibibytes or 1,024 bytes) through PiB (pebibytes or
1,125,899,906,842,624 bytes).

View File

@ -4188,6 +4188,15 @@ static void parse_args (char **args) {
if (0 > tmp_delay)
error_exit(N_txt(DELAY_badarg_txt));
break;
case 'e':
{ const char *get = "kmgtp", *got;
if (cp[1]) cp++;
else if (*args) cp = *args++;
else error_exit(fmtmk(N_fmt(MISSING_args_fmt), ch));
if (!(got = strchr(get, tolower(*cp))))
error_exit(fmtmk(N_fmt(BAD_memscale_fmt), *cp));
Rc.task_mscale = (int)(got - get);
} goto bump_cp;
case 'E':
{ const char *get = "kmgtpe", *got;
if (cp[1]) cp++;

View File

@ -350,7 +350,7 @@ static void build_norm_nlstab (void) {
Norm_nlstab[OFF_one_word_txt] = _("Off");
/* Translation Hint: Only the following words should be translated
. secs (seconds), max (maximum), user, field, cols (columns)*/
Norm_nlstab[USAGE_abbrev_txt] = _(" -hv | -bcEHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w [cols]");
Norm_nlstab[USAGE_abbrev_txt] = _(" -hv | -bcEeHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w [cols]");
Norm_nlstab[FAIL_statget_txt] = _("failed /proc/stat read");
Norm_nlstab[FOREST_modes_fmt] = _("Forest mode %s");
Norm_nlstab[FAIL_tty_get_txt] = _("failed tty get");