Date: Mon, 18 Nov 2019 20:55:01 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354829 - head/usr.bin/top Message-ID: <201911182055.xAIKt1Dl032841@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Mon Nov 18 20:55:01 2019 New Revision: 354829 URL: https://svnweb.freebsd.org/changeset/base/354829 Log: Add a "B" suffix to memory quantities in top(1) output. Otherwise small quantities look nonsensical. For instance, when swapping in a single page we would print "4096 In". Fix code indentation while here. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/top/utils.c Modified: head/usr.bin/top/utils.c ============================================================================== --- head/usr.bin/top/utils.c Mon Nov 18 20:53:57 2019 (r354828) +++ head/usr.bin/top/utils.c Mon Nov 18 20:55:01 2019 (r354829) @@ -291,13 +291,14 @@ format_time(long seconds) char * format_k(int64_t amt) { - static char retarray[NUM_STRINGS][16]; - static int index_ = 0; - char *ret; + static char retarray[NUM_STRINGS][16]; + static int index_ = 0; + char *ret; - ret = retarray[index_]; + ret = retarray[index_]; index_ = (index_ + 1) % NUM_STRINGS; - humanize_number(ret, 6, amt * 1024, "", HN_AUTOSCALE, HN_NOSPACE); + humanize_number(ret, 6, amt * 1024, "", HN_AUTOSCALE, HN_NOSPACE | + HN_B); return (ret); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911182055.xAIKt1Dl032841>