summaryrefslogtreecommitdiff
path: root/misc/ss.c
diff options
context:
space:
mode:
authorTomasz Torcz <tomasz.torcz@nordea.com>2019-07-02 08:53:39 +0200
committerStephen Hemminger <stephen@networkplumber.org>2019-07-08 08:16:23 -0700
commitd791e75d74ffe212563c271f9ffa8a2e371770d5 (patch)
treeb3d210c5e57b9f2ad32694a36ac3d32f38d0833f /misc/ss.c
parentc95e17dcba73e6b45fcdcdb88fc35bf49b298760 (diff)
downloadiproute2-d791e75d74ffe212563c271f9ffa8a2e371770d5.tar.gz
ss: in --numeric mode, print raw numbers for data rates
ss by default shows data rates in human-readable form - as Mbps/Gbps etc. Enhance --numeric mode to show raw values in bps, without conversion. Signed-of-by: Tomasz Torcz <tomasz.torcz@nordea.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Diffstat (limited to 'misc/ss.c')
-rw-r--r--misc/ss.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/misc/ss.c b/misc/ss.c
index 99c06d31..3d9d1d8f 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -2361,7 +2361,9 @@ static int proc_inet_split_line(char *line, char **loc, char **rem, char **data)
static char *sprint_bw(char *buf, double bw)
{
- if (bw > 1000000.)
+ if (!resolve_services)
+ sprintf(buf, "%.0f", bw);
+ else if (bw > 1000000.)
sprintf(buf, "%.1fM", bw / 1000000.);
else if (bw > 1000.)
sprintf(buf, "%.1fK", bw / 1000.);