From: Stephen Hemminger <stephen@networkplumber.org>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: netdev@vger.kernel.org, Sabrina Dubroca <sd@queasysnail.net>,
David Ahern <dsahern@gmail.com>
Subject: Re: [PATCH iproute2 net-next 0/4] Abstract columns, properly space and wrap fields
Date: Mon, 11 Dec 2017 16:07:38 -0800 [thread overview]
Message-ID: <20171211160738.246e2166@xeon-e3> (raw)
In-Reply-To: <cover.1512750298.git.sbrivio@redhat.com>
On Fri, 8 Dec 2017 18:07:19 +0100
Stefano Brivio <sbrivio@redhat.com> wrote:
> Currently, 'ss' simply subdivides the whole available screen width
> between available columns, starting from a set of hardcoded amount
> of spacing and growing column widths.
>
> This makes the output unreadable in several cases, as it doesn't take
> into account the actual content width.
>
> Fix this by introducing a simple abstraction for columns, buffering
> the output, measuring the width of the fields, grouping fields into
> lines as they fit, equally distributing any remaining whitespace, and
> finally rendering the result. Some examples are reported below [1].
>
> This implementation doesn't seem to cause any significant performance
> issues, as reported in 3/4.
>
> Patch 1/4 replaces all relevant printf() calls by the out() helper,
> which simply consists of the usual printf() implementation.
>
> Patch 2/4 implements column abstraction, with configurable column
> width and delimiters, and 3/4 splits buffering and rendering phases,
> employing a simple buffering mechanism with chunked allocation and
> introducing a rendering function.
>
> Up to this point, the output is still unchanged.
>
> Finally, 4/4 introduces field width calculation based on content
> length measured while buffering, in order to split fields onto
> multiple lines and equally space them within the single lines.
>
> Now that column behaviour is well-defined and more easily
> configurable, it should be easier to further improve the output by
> splitting logically separable information (e.g. TCP details) into
> additional columns. However, this patchset keeps the full "extended"
> information into a single column, for the moment being.
>
>
> [1]
>
> - 80 columns terminal, ss -Z -f netlink
> * before:
> Recv-Q Send-Q Local Address:Port Peer Address:Port
>
> 0 0 rtnl:evolution-calen/2075 * pr
> oc_ctx=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
> 0 0 rtnl:abrt-applet/32700 * pr
> oc_ctx=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
> 0 0 rtnl:firefox/21619 * pr
> oc_ctx=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
> 0 0 rtnl:evolution-calen/32639 * p
> roc_ctx=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
> [...]
>
> * after:
> Recv-Q Send-Q Local Address:Port Peer Address:Port
> 0 0 rtnl:evolution-calen/2075 *
> proc_ctx=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
> 0 0 rtnl:abrt-applet/32700 *
> proc_ctx=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
> 0 0 rtnl:firefox/21619 *
> proc_ctx=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
> 0 0 rtnl:evolution-calen/32639 *
> proc_ctx=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
> [...]
>
> - 80 colums terminal, ss -tunpl
> * before:
> Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
> udp UNCONN 0 0 *:37732 *:*
> udp UNCONN 0 0 *:5353 *:*
> udp UNCONN 0 0 192.168.122.1:53 *:*
> udp UNCONN 0 0 *%virbr0:67 *:*
> [...]
>
> * after:
> Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
> udp UNCONN 0 0 *:37732 *:*
> udp UNCONN 0 0 *:5353 *:*
> udp UNCONN 0 0 192.168.122.1:53 *:*
> udp UNCONN 0 0 *%virbr0:67 *:*
> [...]
>
> - 66 columns terminal, ss -tunpl
> * before:
> Netid State Recv-Q Send-Q Local Address:Port P
> eer Address:Port
> udp UNCONN 0 0 *:37732 *:*
>
> udp UNCONN 0 0 *:5353 *:*
>
> udp UNCONN 0 0 192.168.122.1:53
> *:*
> udp UNCONN 0 0 *%virbr0:67 *:*
> [...]
>
> * after:
> Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
> udp UNCONN 0 0 *:37732 *:*
> udp UNCONN 0 0 *:5353 *:*
> udp UNCONN 0 0 192.168.122.1:53 *:*
> udp UNCONN 0 0 *%virbr0:67 *:*
> [...]
>
>
> Stefano Brivio (4):
> ss: Replace printf() calls for "main" output by calls to helper
> ss: Introduce columns lightweight abstraction
> ss: Buffer raw fields first, then render them as a table
> ss: Implement automatic column width calculation
I was going to apply this but it does not apply cleanly to current iproute2 net-next
tree. Please rebase and resubmit.
prev parent reply other threads:[~2017-12-12 0:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 17:07 [PATCH iproute2 net-next 0/4] Abstract columns, properly space and wrap fields Stefano Brivio
2017-12-08 17:07 ` [PATCH iproute2 net-next 1/4] ss: Replace printf() calls for "main" output by calls to helper Stefano Brivio
2017-12-08 17:07 ` [PATCH iproute2 net-next 2/4] ss: Introduce columns lightweight abstraction Stefano Brivio
2017-12-08 17:07 ` [PATCH iproute2 net-next 3/4] ss: Buffer raw fields first, then render them as a table Stefano Brivio
2017-12-08 17:07 ` [PATCH iproute2 net-next 4/4] ss: Implement automatic column width calculation Stefano Brivio
2017-12-08 18:29 ` [PATCH iproute2 net-next 0/4] Abstract columns, properly space and wrap fields Stephen Hemminger
2017-12-09 16:36 ` David Ahern
2017-12-12 0:07 ` Stephen Hemminger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171211160738.246e2166@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=dsahern@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=sbrivio@redhat.com \
--cc=sd@queasysnail.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.