From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Brivio Subject: Re: [PATCH iproute2 net-next 0/3] ss: Allow selection of columns to be displayed Date: Tue, 30 Oct 2018 18:34:20 +0100 Message-ID: <20181030183420.181b3d51@redhat.com> References: <7ffc00c8-bdf6-5c75-564e-2663494bda5d@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "Yoann P." , Stephen Hemminger , netdev@vger.kernel.org To: David Ahern Return-path: Received: from mx1.redhat.com ([209.132.183.28]:46628 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727704AbeJaC2v (ORCPT ); Tue, 30 Oct 2018 22:28:51 -0400 In-Reply-To: <7ffc00c8-bdf6-5c75-564e-2663494bda5d@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: On Tue, 30 Oct 2018 10:34:45 -0600 David Ahern wrote: > A more flexible approach is to use format strings to allow users to > customize the output order and whitespace as well. So for ss and your > column list (winging it here): > > netid = %N > state = %S > recv Q = %Qr > send Q = %Qs > local address = %Al > lport port = %Pl > remote address = %Ar > remote port = %Pr > process data = %p > ... > > then a format string could be: "%S %Qr %Qs %Al:%Pl %Ar:%Pr %p\n" I like the idea indeed, but I see two issues with ss: - the current column abstraction is rather lightweight, things are already buffered in the defined column order so we don't have to jump back and forth in the buffer while rendering. Doing that needs some extra care to avoid a performance hit, but it's probably doable, I can put that on my to-do list - how would you model automatic spacing in a format string? Should we support width specifiers? Disable automatic spacing if a format string is given? It might even make sense to allow partial automatic spacing with a special character in the format string, that is: "%S.%Qr.%Qs %Al:%Pl %Ar:%Pr %p\n" would mean "align everything to the right, distribute remaining whitespace between %S, %Qr and %Qs". But it looks rather complicated at a glance. -- Stefano