]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
ss: in --numeric mode, print raw numbers for data rates
authorTomasz Torcz <tomasz.torcz@nordea.com>
Tue, 2 Jul 2019 06:53:39 +0000 (08:53 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 8 Jul 2019 15:16:23 +0000 (08:16 -0700)
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>
man/man8/ss.8
misc/ss.c

index 9054fab9be6928c619be3cd66bea77a9a28c8148..f428e60cc19496c7b98052bc81d67cc53e9b97e8 100644 (file)
@@ -28,7 +28,7 @@ Suppress header line.
 Print each socket's data on a single line.
 .TP
 .B \-n, \-\-numeric
-Do not try to resolve service names.
+Do not try to resolve service names. Show exact bandwidth values, instead of human-readable.
 .TP
 .B \-r, \-\-resolve
 Try to resolve numeric address/ports.
index 99c06d31fdb0955960c695be22651787bfb8df81..3d9d1d8f7da0daebab56032cee38864cd1fb92ba 100644 (file)
--- 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.);