]> granicus.if.org Git - procps-ng/commitdiff
top: for symmetry with 'E' add 'e' command line switch
authorJim Warner <james.warner@comcast.net>
Sun, 29 Mar 2020 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Fri, 10 Apr 2020 04:35:17 +0000 (14:35 +1000)
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 fb48b5d9fb7a8256ae6b99fd5f7ac9855aa2481d
. 12/2012, added 'e' interactive command
commit 21e550bc080eb30f503b2ca6fe4e9cb12b8a1616
. 12/2012, added 'E' interactive command
commit bc46f67f9a63c9f43c9a697b3bfa85abf721c5da

Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.1
top/top.c
top/top_nls.c

index 39612d6d8e7bf5625b1d9376ab5194a1891d1332..64d5895029a6675f2c8c1d5ee9a43a7b34ddd784 100644 (file)
--- a/top/top.1
+++ b/top/top.1
@@ -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).
 
index ce512e6ad5eef577da79b457cc5201677bc220a1..74567fc5e565a1e1cc6b5d78e0af9f364407a124 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -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++;
index dab293e4924b993e26c93065e38a5d2fbfd5eb40..2be00a9ed3c9f0cc96592699fceadeef1836c958 100644 (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");