aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2019-11-18 20:55:01 +0000
committerMark Johnston <markj@FreeBSD.org>2019-11-18 20:55:01 +0000
commit738b2d5ceb4ffd08a3390191d527994060cb1665 (patch)
tree1f3d1d77f73732a2e6c0d03df4312ba42a6996a8 /usr.bin
parentfa83f68917778340b94b61fce19ee17aa3fc6860 (diff)
downloadsrc-738b2d5ceb4ffd08a3390191d527994060cb1665.tar.gz
src-738b2d5ceb4ffd08a3390191d527994060cb1665.zip
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
Notes
Notes: svn path=/head/; revision=354829
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/top/utils.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/top/utils.c b/usr.bin/top/utils.c
index b3d4b15be28b..1abecc9cac82 100644
--- a/usr.bin/top/utils.c
+++ b/usr.bin/top/utils.c
@@ -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);
}