schweikert / fping

High performance ping tool

Home Page:https://fping.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for ctrl-t/SIGINFO

danielhoherd opened this issue · comments

Some commands, including ping, implement handling of SIGINFO as a way to trigger an informational message about the command without interrupting it. I would love to see fping handle this.

Ping example:

$ ping github.com
PING github.com (192.30.255.113): 56 data bytes
64 bytes from 192.30.255.113: icmp_seq=0 ttl=52 time=29.815 ms
64 bytes from 192.30.255.113: icmp_seq=1 ttl=52 time=27.246 ms
64 bytes from 192.30.255.113: icmp_seq=2 ttl=52 time=33.425 ms
load: 1.92  cmd: ping 65441 running 0.00u 0.00s                       # ctrl-t triggered output
3/3 packets received (100.0%) 27.246 min / 30.162 avg / 33.425 max    # ctrl-t triggered output
64 bytes from 192.30.255.113: icmp_seq=3 ttl=52 time=29.016 ms
64 bytes from 192.30.255.113: icmp_seq=4 ttl=52 time=35.622 ms
64 bytes from 192.30.255.113: icmp_seq=5 ttl=52 time=33.585 ms
64 bytes from 192.30.255.113: icmp_seq=6 ttl=52 time=33.347 ms
load: 2.01  cmd: ping 65441 running 0.00u 0.00s                       # ctrl-t triggered output
7/7 packets received (100.0%) 27.246 min / 31.722 avg / 35.622 max    # ctrl-t triggered output
64 bytes from 192.30.255.113: icmp_seq=7 ttl=52 time=34.317 ms
64 bytes from 192.30.255.113: icmp_seq=8 ttl=52 time=34.098 ms
64 bytes from 192.30.255.113: icmp_seq=9 ttl=52 time=35.008 ms
64 bytes from 192.30.255.113: icmp_seq=10 ttl=52 time=34.328 ms
^C
--- github.com ping statistics ---
11 packets transmitted, 11 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 27.246/32.710/35.622/2.602 ms

I think it would make sense for SIGINFO to trigger the same info as the final output summary.

Looking at the ping man page - this is associated with SIGQUIT:
https://linux.die.net/man/8/ping

When the specified number of packets have been sent (and received) or if the program is terminated with a SIGINT, a brief summary is displayed. Shorter current statistics can be obtained without termination of process with signal SIGQUIT.

In a Linux bash terminal - this is done by doing Ctrl + 4 or if you want to see this on all ping sessions: killall -QUIT ping

Basic fping with many hosts reports the status of those hosts. What should it show? The stats (-s) from fping takes quite a bit of space, is this what is expected or something else?

Actually ctrl-4 is exactly what I wanted. Thanks!

It's probably worth pointing out that in ping, ctrl-4 exits, but ctrl-t continues.

Looking again today, the experience I am having is that when I press ctrl-4 fping just quits and core dumps: ^\Quit (core dumped). Seems like ctrl-t (show stats and continue operating) would still be useful.

Edit: looking a bit more, I am seeing differences between homebrew bash and ubuntu linux bash, mainly that ctrl-4 and ctrl-T are functioning differently in fping and ping. stty -a shows that macOS has status = ^T; but I don't see anything like that in linux, or anything listed for ^T or ^4, so it seems like that's not a complete view of control sequences.