Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jul 2018 14:05:18 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336707 - head/usr.bin/top
Message-ID:  <201807251405.w6PE5Inf001397@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Wed Jul 25 14:05:17 2018
New Revision: 336707
URL: https://svnweb.freebsd.org/changeset/base/336707

Log:
  top(1): increase number of columns for memory
  
  The original intention was 4 columns but with a usable a result. In
  practice this was not the case. Increase the number of columns to 5
  until humanize_number learns alternative ways of presenting the number.
  
  Requested by:	many
  Ref D15801

Modified:
  head/usr.bin/top/machine.c
  head/usr.bin/top/utils.c

Modified: head/usr.bin/top/machine.c
==============================================================================
--- head/usr.bin/top/machine.c	Wed Jul 25 13:27:20 2018	(r336706)
+++ head/usr.bin/top/machine.c	Wed Jul 25 14:05:17 2018	(r336707)
@@ -388,7 +388,7 @@ format_header(const char *uname_field)
 		sbuf_printf(header, "%*s", ps.jail ? TOP_JID_LEN : 0,
 									ps.jail ? " JID" : "");
 		sbuf_printf(header, " %-*.*s  ", namelength, namelength, uname_field);
-		sbuf_cat(header, "THR PRI NICE  SIZE   RES ");
+		sbuf_cat(header, "THR PRI NICE   SIZE    RES ");
 		if (ps.swap) {
 			sbuf_printf(header, "%*s ", TOP_SWAP_LEN - 1, "SWAP");
 		}
@@ -1064,8 +1064,8 @@ format_next_process(struct handle * xhandle, char *(*g
 
 		sbuf_printf(procbuf, "%3d ", pp->ki_pri.pri_level - PZERO);
 		sbuf_printf(procbuf, "%4s", format_nice(pp));
-		sbuf_printf(procbuf, "%6s ", format_k(PROCSIZE(pp)));
-		sbuf_printf(procbuf, "%5s ", format_k(pagetok(pp->ki_rssize)));
+		sbuf_printf(procbuf, "%7s ", format_k(PROCSIZE(pp)));
+		sbuf_printf(procbuf, "%6s ", format_k(pagetok(pp->ki_rssize)));
 		if (ps.swap) {
 			sbuf_printf(procbuf, "%*s ",
 				TOP_SWAP_LEN - 1,

Modified: head/usr.bin/top/utils.c
==============================================================================
--- head/usr.bin/top/utils.c	Wed Jul 25 13:27:20 2018	(r336706)
+++ head/usr.bin/top/utils.c	Wed Jul 25 14:05:17 2018	(r336707)
@@ -297,7 +297,7 @@ format_k(int64_t amt)
 
     ret = retarray[index];
 	index = (index + 1) % NUM_STRINGS;
-	humanize_number(ret, 5, amt * 1024, "", HN_AUTOSCALE, HN_NOSPACE);
+	humanize_number(ret, 6, amt * 1024, "", HN_AUTOSCALE, HN_NOSPACE);
 	return (ret);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807251405.w6PE5Inf001397>