]> granicus.if.org Git - procps-ng/commitdiff
top: extend scaled summary memory range to include EiB
authorJim Warner <james.warner@comcast.net>
Tue, 18 Dec 2012 06:00:00 +0000 (00:00 -0600)
committerCraig Small <csmall@enc.com.au>
Sat, 22 Dec 2012 06:10:12 +0000 (17:10 +1100)
This commit increases the upper limit for summary area
memory scaling to 9999.999 Exbibytes. It also enhances
the man page through a helpful table for equivalences.

(now that we know a '.' + 2 spaces is squeezed to one)
(everything's perfectly justified, but it's just luck)

Reference(s):
http://www.freelists.org/post/procps/top-regression-reports
http://www.freelists.org/post/procps/top-enhancements-i-hope,1

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

index fb9d740c2373c510e7e0a6a876c75d5f954d6c37..1156cef67d140707010886e7bc97fce4a8504708 100644 (file)
--- a/top/top.1
+++ b/top/top.1
@@ -420,15 +420,29 @@ kernel versions are shown first.
 .\" ......................................................................
 .SS 2c. MEMORY Usage
 .\" ----------------------------------------------------------------------
-This portion consists of two lines which may express values in kibibytes (KiB),
-mebibytes (MiB) or gibibytes (GiB) depending on the scaling factor enforced
+This portion consists of two lines which may express values in kibibytes (KiB)
+through exbibytes (EiB) depending on the scaling factor enforced
 with the 'E' \*(CI.
 
 Line 1 reflects \*(MP, classified as:
+.Bd -literal -compact
     total, used, free and buffers
+.Ed
 
 Line 2 reflects mostly \*(MV, classified as:
+.Bd -literal -compact
     total, used, free and cached (which is \*(MP)
+.Ed
+
+This table may help in interpreting the scaled values displayed:
+.Bd -literal -compact
+    KiB = kibibyte = 1024 bytes
+    MiB = mebibyte = 1024 KiB = 1,048,576 bytes
+    GiB = gibibyte = 1024 MiB = 1,073,741,824 bytes
+    TiB = tebibyte = 1024 GiB = 1,099,511,627,776 bytes
+    PiB = pebibyte = 1024 TiB = 1,125,899,906,842,624 bytes
+    EiB = exbibyte = 1024 PiB = 1,152,921,504,606,846,976 bytes
+.Ed
 
 .\" ----------------------------------------------------------------------
 .SH 3. FIELDS / Columns
@@ -947,12 +961,12 @@ help and view the system summary on the second line.
 .TP 7
 \ \ \'\fBE\fR\' :\fIExtend-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 TiB (tebibytes or
-1,099,511,627,776 bytes).
+which ranges from KiB (kibibytes or 1,024 bytes) through EiB (exbibytes or
+1,152,921,504,606,846,976 bytes).
 
 If you see a '+' between a displayed number and the following label, it
 means that \*(We was forced to truncate some portion of that number.
-By raising the scaling factor, such truncation can usually be avoided.
+By raising the scaling factor, such truncation can be avoided.
 
 .TP 7
 \ \ \'\fBe\fR\' :\fIExtend-Memory-Scale\fR in Task Windows
index 1786ab102a5d7bcffc6dfb2dc4a256ace4306e59..f94af0546a60c753a56bbe419624e9f0c764286b 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -3834,10 +3834,10 @@ static void keys_global (int ch) {
          }
          break;
       case 'E':
-         if (++Rc.summ_mscale >= SK_SENTINEL) Rc.summ_mscale = SK_Kb;
+         if (++Rc.summ_mscale > SK_Eb) Rc.summ_mscale = SK_Kb;
          break;
       case 'e':
-         if (++Rc.task_mscale >= SK_SENTINEL) Rc.task_mscale = SK_Kb;
+         if (++Rc.task_mscale > SK_Tb) Rc.task_mscale = SK_Kb;
          break;
       case 'F':
       case 'f':
@@ -4545,14 +4545,16 @@ static void summary_show (void) {
          const char *fmts;
          const char *label;
       } scaletab[] = {
-         { 1, "%8.0f ", NULL },                  // kilo
-         { 1024.0, "%#5.2f ", NULL },            // mega
-         { 1024.0*1024, "%#4.3f ", NULL },       // giga
-         { 1024.0*1024*1024, "%#3.4f ", NULL }   // tera
+         { 1, "%8.0f ", NULL },                            // kibibytes
+         { 1024.0, "%#4.3f ", NULL },                      // mebibytes
+         { 1024.0*1024, "%#4.3f ", NULL },                 // gibibytes
+         { 1024.0*1024*1024, "%#4.3f ", NULL },            // tebibytes
+         { 1024.0*1024*1024*1024, "%#4.3f ", NULL },       // pebibytes
+         { 1024.0*1024*1024*1024*1024, "%#4.3f ", NULL }   // exbibytes
       };
-      struct {
-      // after snprintf, contents of each buf:         'nnnnnnnn 0'
-      // and prT macro might replace space at buf[8] with: ---> +
+      struct { //                                            0123456789
+      // snprintf contents of each buf (after SK_Kb):       'nnnn.nnn 0'
+      // and prT macro might replace space at buf[8] with:   ------> +
          char buf[10]; // MEMORY_lines_fmt provides for 8+1 bytes
       } buftab[8];
 
@@ -4561,6 +4563,8 @@ static void summary_show (void) {
          scaletab[1].label = N_txt(AMT_megabyte_txt);
          scaletab[2].label = N_txt(AMT_gigabyte_txt);
          scaletab[3].label = N_txt(AMT_terabyte_txt);
+         scaletab[4].label = N_txt(AMT_petabyte_txt);
+         scaletab[5].label = N_txt(AMT_exxabyte_txt);
       }
       prT(bfT(0), mkM(total)); prT(bfT(1), mkM(used));
       prT(bfT(2), mkM(free));  prT(bfT(3), mkM(buffers));
@@ -4568,8 +4572,8 @@ static void summary_show (void) {
       prT(bfT(6), mkS(free));  prT(bfT(7), mkM(cached));
 
       show_special(0, fmtmk(N_unq(MEMORY_lines_fmt)
-         , scT(label), &bfT(0), &bfT(1), &bfT(2), &bfT(3)
-         , scT(label), &bfT(4), &bfT(5), &bfT(6), &bfT(7)));
+         , scT(label), bfT(0), bfT(1), bfT(2), bfT(3)
+         , scT(label), bfT(4), bfT(5), bfT(6), bfT(7)));
       Msg_row += 2;
     #undef bfT
     #undef scT
index 4eb58ad42319a2a95e19b5428f3dba3daaf3333d..7ee38e8febf9e398b94a8ff1618f91081e527e14 100644 (file)
--- a/top/top.h
+++ b/top/top.h
@@ -194,7 +194,7 @@ enum pflag {
 
         /* The scaling 'target' used with memory fields */
 enum scale_enum {
-   SK_Kb, SK_Mb, SK_Gb, SK_Tb, SK_SENTINEL
+   SK_Kb, SK_Mb, SK_Gb, SK_Tb, SK_Pb, SK_Eb, SK_SENTINEL
 };
 
         /* This typedef just ensures consistent 'process flags' handling */
index 66dfeeb246b42a35d282158319c39841944cbd2c..18b76516175f877118f7bada7ca43b2c842045bb 100644 (file)
@@ -356,6 +356,12 @@ static void build_norm_nlstab (void) {
 /* Translation Hint: This is an abbreviation (limit 3 characters) for:
    .                 tebibytes (1,099,511,627,776 bytes) */
    Norm_nlstab[AMT_terabyte_txt] = _("TiB");
+/* Translation Hint: This is an abbreviation (limit 3 characters) for:
+   .                 pebibytes (1,024 tebibytes) */
+   Norm_nlstab[AMT_petabyte_txt] = _("PiB");
+/* Translation Hint: This is an abbreviation (limit 3 characters) for:
+   .                 exbibytes (1,024 pebibytes) */
+   Norm_nlstab[AMT_exxabyte_txt] = _("EiB");
    Norm_nlstab[WORD_threads_txt] = _("Threads");
    Norm_nlstab[WORD_process_txt] = _("Tasks");
 /* Translation Hint: The following "word" is meant to represent either a single
index e1488b423dd5652c64e48703fb462fea2b09cda4..52a1e2c3abf7d7459fb5f49ebd514962b6879fdf 100644 (file)
@@ -63,24 +63,25 @@ extern const char *Uniq_nlstab[];
          */
 enum norm_nls {
    AMT_kilobyte_txt, AMT_megabyte_txt, AMT_gigabyte_txt, AMT_terabyte_txt,
-   BAD_delayint_fmt, BAD_integers_txt, BAD_max_task_txt, BAD_mon_pids_fmt,
-   BAD_niterate_fmt, BAD_numfloat_txt, BAD_signalid_txt, BAD_username_txt,
-   BAD_widtharg_fmt, CHOOSE_group_txt, COLORS_nomap_txt, DELAY_badarg_txt,
-   DELAY_change_fmt, DELAY_secure_txt, DISABLED_cmd_txt, DISABLED_win_fmt,
-   EXIT_signals_fmt, FAIL_alloc_c_txt, FAIL_alloc_r_txt, FAIL_openlib_fmt,
-   FAIL_rc_open_fmt, FAIL_re_nice_fmt, FAIL_sigmask_fmt, FAIL_signals_fmt,
-   FAIL_sigstop_fmt, FAIL_statget_txt, FAIL_statopn_fmt, FAIL_tty_get_txt,
-   FAIL_tty_mod_fmt, FAIL_tty_raw_fmt, FAIL_widecpu_txt, FAIL_widepid_txt,
-   FIND_no_find_fmt, FIND_no_next_txt, FOREST_modes_fmt, FOREST_views_txt,
-   GET_find_str_txt, GET_max_task_fmt, GET_nice_num_fmt, GET_pid2kill_fmt,
-   GET_pid2nice_fmt, GET_sigs_num_fmt, GET_user_ids_txt, HELP_cmdline_fmt,
-   HILIGHT_cant_txt, IRIX_curmode_fmt, LIMIT_exceed_fmt, MISSING_args_fmt,
-   NAME_windows_fmt, NOT_onsecure_txt, NOT_smp_cpus_txt, OFF_one_word_txt,
-   ON_word_only_txt, RC_bad_entry_fmt, RC_bad_files_fmt, SCROLL_coord_fmt,
-   SELECT_clash_txt, THREADS_show_fmt, TIME_accumed_fmt, UNKNOWN_cmds_txt,
-   UNKNOWN_opts_fmt, USAGE_abbrev_txt, WORD_allcpus_txt, WORD_another_txt,
-   WORD_eachcpu_fmt, WORD_process_txt, WORD_threads_txt, WRITE_rcfile_fmt,
-   WRONG_switch_fmt, XTRA_fixwide_fmt, XTRA_sortopt_fmt, XTRA_warncfg_txt,
+   AMT_petabyte_txt, AMT_exxabyte_txt, BAD_delayint_fmt, BAD_integers_txt,
+   BAD_max_task_txt, BAD_mon_pids_fmt, BAD_niterate_fmt, BAD_numfloat_txt,
+   BAD_signalid_txt, BAD_username_txt, BAD_widtharg_fmt, CHOOSE_group_txt,
+   COLORS_nomap_txt, DELAY_badarg_txt, DELAY_change_fmt, DELAY_secure_txt,
+   DISABLED_cmd_txt, DISABLED_win_fmt, EXIT_signals_fmt, FAIL_alloc_c_txt,
+   FAIL_alloc_r_txt, FAIL_openlib_fmt, FAIL_rc_open_fmt, FAIL_re_nice_fmt,
+   FAIL_sigmask_fmt, FAIL_signals_fmt, FAIL_sigstop_fmt, FAIL_statget_txt,
+   FAIL_statopn_fmt, FAIL_tty_get_txt, FAIL_tty_mod_fmt, FAIL_tty_raw_fmt,
+   FAIL_widecpu_txt, FAIL_widepid_txt, FIND_no_find_fmt, FIND_no_next_txt,
+   FOREST_modes_fmt, FOREST_views_txt, GET_find_str_txt, GET_max_task_fmt,
+   GET_nice_num_fmt, GET_pid2kill_fmt, GET_pid2nice_fmt, GET_sigs_num_fmt,
+   GET_user_ids_txt, HELP_cmdline_fmt, HILIGHT_cant_txt, IRIX_curmode_fmt,
+   LIMIT_exceed_fmt, MISSING_args_fmt, NAME_windows_fmt, NOT_onsecure_txt,
+   NOT_smp_cpus_txt, OFF_one_word_txt, ON_word_only_txt, RC_bad_entry_fmt,
+   RC_bad_files_fmt, SCROLL_coord_fmt, SELECT_clash_txt, THREADS_show_fmt,
+   TIME_accumed_fmt, UNKNOWN_cmds_txt, UNKNOWN_opts_fmt, USAGE_abbrev_txt,
+   WORD_allcpus_txt, WORD_another_txt, WORD_eachcpu_fmt, WORD_process_txt,
+   WORD_threads_txt, WRITE_rcfile_fmt, WRONG_switch_fmt, XTRA_fixwide_fmt,
+   XTRA_sortopt_fmt, XTRA_warncfg_txt,
 #ifndef INSP_OFFDEMO
    YINSP_demo01_txt, YINSP_demo02_txt, YINSP_demo03_txt, YINSP_deqfmt_txt,
    YINSP_deqtyp_txt, YINSP_dstory_txt,