* [PATCH] ss: add option to suppress queue columns
@ 2023-12-27 13:44 Christian Göttsche
2024-01-08 1:43 ` David Ahern
0 siblings, 1 reply; 4+ messages in thread
From: Christian Göttsche @ 2023-12-27 13:44 UTC (permalink / raw)
To: netdev
Add a new option `-Q/--no-queues` to ss(8) to suppress the two standard
columns Send-Q and Recv-Q. This helps to keep the output steady for
monitoring purposes (like listening sockets).
Signed-off-by: Christian Göttsche <cgzones@googlemail•com>
---
man/man8/ss.8 | 3 +++
misc/ss.c | 24 +++++++++++++++++++-----
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/man/man8/ss.8 b/man/man8/ss.8
index 073e9f03..ecb3ae35 100644
--- a/man/man8/ss.8
+++ b/man/man8/ss.8
@@ -24,6 +24,9 @@ Output version information.
.B \-H, \-\-no-header
Suppress header line.
.TP
+.B \-Q, \-\-no-queues
+Suppress sending and receiving queue columns.
+.TP
.B \-O, \-\-oneline
Print each socket's data on a single line.
.TP
diff --git a/misc/ss.c b/misc/ss.c
index 09dc1f37..00b661e1 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -75,6 +75,7 @@
int preferred_family = AF_UNSPEC;
static int show_options;
int show_details;
+static int show_queues = 1;
static int show_processes;
static int show_threads;
static int show_mem;
@@ -1420,10 +1421,13 @@ static void sock_state_print(struct sockstat *s)
out("%s", sstate_name[s->state]);
}
- field_set(COL_RECVQ);
- out("%-6d", s->rq);
- field_set(COL_SENDQ);
- out("%-6d", s->wq);
+ if (show_queues) {
+ field_set(COL_RECVQ);
+ out("%-6d", s->rq);
+ field_set(COL_SENDQ);
+ out("%-6d", s->wq);
+ }
+
field_set(COL_ADDR);
}
@@ -5367,6 +5371,7 @@ static void _usage(FILE *dest)
"\n"
" -K, --kill forcibly close sockets, display what was closed\n"
" -H, --no-header Suppress header line\n"
+" -Q, --no-queues Suppress sending and receiving queue columns\n"
" -O, --oneline socket's data printed on a single line\n"
" --inet-sockopt show various inet socket options\n"
"\n"
@@ -5500,6 +5505,7 @@ static const struct option long_opts[] = {
{ "cgroup", 0, 0, OPT_CGROUP },
{ "kill", 0, 0, 'K' },
{ "no-header", 0, 0, 'H' },
+ { "no-queues", 0, 0, 'Q' },
{ "xdp", 0, 0, OPT_XDPSOCK},
{ "mptcp", 0, 0, 'M' },
{ "oneline", 0, 0, 'O' },
@@ -5519,7 +5525,7 @@ int main(int argc, char *argv[])
int state_filter = 0;
while ((ch = getopt_long(argc, argv,
- "dhaletuwxnro460spTbEf:mMiA:D:F:vVzZN:KHSO",
+ "dhaletuwxnro460spTbEf:mMiA:D:F:vVzZN:KHQSO",
long_opts, NULL)) != EOF) {
switch (ch) {
case 'n':
@@ -5700,6 +5706,9 @@ int main(int argc, char *argv[])
case 'H':
show_header = 0;
break;
+ case 'Q':
+ show_queues = 0;
+ break;
case 'O':
oneline = 1;
break;
@@ -5795,6 +5804,11 @@ int main(int argc, char *argv[])
if (ssfilter_parse(¤t_filter.f, argc, argv, filter_fp))
usage();
+ if (!show_queues) {
+ columns[COL_SENDQ].disabled = 1;
+ columns[COL_RECVQ].disabled = 1;
+ }
+
if (!show_processes)
columns[COL_PROC].disabled = 1;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ss: add option to suppress queue columns
2023-12-27 13:44 [PATCH] ss: add option to suppress queue columns Christian Göttsche
@ 2024-01-08 1:43 ` David Ahern
0 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2024-01-08 1:43 UTC (permalink / raw)
To: Christian Göttsche, netdev
On 12/27/23 6:44 AM, Christian Göttsche wrote:
> Add a new option `-Q/--no-queues` to ss(8) to suppress the two standard
> columns Send-Q and Recv-Q. This helps to keep the output steady for
> monitoring purposes (like listening sockets).
>
> Signed-off-by: Christian Göttsche <cgzones@googlemail•com>
> ---
> man/man8/ss.8 | 3 +++
> misc/ss.c | 24 +++++++++++++++++++-----
> 2 files changed, 22 insertions(+), 5 deletions(-)
>
does not apply to iproute2-next.
--
pw-bot: cr
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ss: add option to suppress queue columns
@ 2024-01-08 11:10 Christian Göttsche
2024-01-22 4:01 ` David Ahern
0 siblings, 1 reply; 4+ messages in thread
From: Christian Göttsche @ 2024-01-08 11:10 UTC (permalink / raw)
To: netdev
Add a new option `-Q/--no-queues` to ss(8) to suppress the two standard
columns Send-Q and Recv-Q. This helps to keep the output steady for
monitoring purposes (like listening sockets).
Signed-off-by: Christian Göttsche <cgzones@googlemail•com>
---
v2: rebase to iproute2-next
---
man/man8/ss.8 | 3 +++
misc/ss.c | 24 +++++++++++++++++++-----
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/man/man8/ss.8 b/man/man8/ss.8
index 4ece41fa..b014cde1 100644
--- a/man/man8/ss.8
+++ b/man/man8/ss.8
@@ -24,6 +24,9 @@ Output version information.
.B \-H, \-\-no-header
Suppress header line.
.TP
+.B \-Q, \-\-no-queues
+Suppress sending and receiving queue columns.
+.TP
.B \-O, \-\-oneline
Print each socket's data on a single line.
.TP
diff --git a/misc/ss.c b/misc/ss.c
index c220a075..188a8ff9 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -75,6 +75,7 @@
int preferred_family = AF_UNSPEC;
static int show_options;
int show_details;
+static int show_queues = 1;
static int show_processes;
static int show_threads;
static int show_mem;
@@ -1425,10 +1426,13 @@ static void sock_state_print(struct sockstat *s)
out("%s", sstate_name[s->state]);
}
- field_set(COL_RECVQ);
- out("%-6d", s->rq);
- field_set(COL_SENDQ);
- out("%-6d", s->wq);
+ if (show_queues) {
+ field_set(COL_RECVQ);
+ out("%-6d", s->rq);
+ field_set(COL_SENDQ);
+ out("%-6d", s->wq);
+ }
+
field_set(COL_ADDR);
}
@@ -5378,6 +5382,7 @@ static void _usage(FILE *dest)
"\n"
" -K, --kill forcibly close sockets, display what was closed\n"
" -H, --no-header Suppress header line\n"
+" -Q, --no-queues Suppress sending and receiving queue columns\n"
" -O, --oneline socket's data printed on a single line\n"
" --inet-sockopt show various inet socket options\n"
"\n"
@@ -5521,6 +5526,7 @@ static const struct option long_opts[] = {
{ "cgroup", 0, 0, OPT_CGROUP },
{ "kill", 0, 0, 'K' },
{ "no-header", 0, 0, 'H' },
+ { "no-queues", 0, 0, 'Q' },
{ "xdp", 0, 0, OPT_XDPSOCK},
{ "mptcp", 0, 0, 'M' },
{ "oneline", 0, 0, 'O' },
@@ -5540,7 +5546,7 @@ int main(int argc, char *argv[])
int state_filter = 0;
while ((ch = getopt_long(argc, argv,
- "dhalBetuwxnro460spTbEf:mMiA:D:F:vVzZN:KHSO",
+ "dhalBetuwxnro460spTbEf:mMiA:D:F:vVzZN:KHQSO",
long_opts, NULL)) != EOF) {
switch (ch) {
case 'n':
@@ -5724,6 +5730,9 @@ int main(int argc, char *argv[])
case 'H':
show_header = 0;
break;
+ case 'Q':
+ show_queues = 0;
+ break;
case 'O':
oneline = 1;
break;
@@ -5819,6 +5828,11 @@ int main(int argc, char *argv[])
if (ssfilter_parse(¤t_filter.f, argc, argv, filter_fp))
usage();
+ if (!show_queues) {
+ columns[COL_SENDQ].disabled = 1;
+ columns[COL_RECVQ].disabled = 1;
+ }
+
if (!(current_filter.dbs & (current_filter.dbs - 1)))
columns[COL_NETID].disabled = 1;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ss: add option to suppress queue columns
2024-01-08 11:10 Christian Göttsche
@ 2024-01-22 4:01 ` David Ahern
0 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2024-01-22 4:01 UTC (permalink / raw)
To: Christian Göttsche, netdev
On 1/8/24 4:10 AM, Christian Göttsche wrote:
> Add a new option `-Q/--no-queues` to ss(8) to suppress the two standard
> columns Send-Q and Recv-Q. This helps to keep the output steady for
> monitoring purposes (like listening sockets).
>
> Signed-off-by: Christian Göttsche <cgzones@googlemail•com>
> ---
> v2: rebase to iproute2-next
> ---
> man/man8/ss.8 | 3 +++
> misc/ss.c | 24 +++++++++++++++++++-----
> 2 files changed, 22 insertions(+), 5 deletions(-)
>
applied to iproute2-next
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-22 4:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-27 13:44 [PATCH] ss: add option to suppress queue columns Christian Göttsche
2024-01-08 1:43 ` David Ahern
-- strict thread matches above, loose matches on Subject: below --
2024-01-08 11:10 Christian Göttsche
2024-01-22 4:01 ` David Ahern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox