Unable to compare ping times on fly

前端 未结 3 1134
不知归路
不知归路 2021-01-28 00:22

I tried the following command unsuccessfully

sdiff <(ping www.nato.int) <(ping www.reuters.com)

Is there any way to have a real-t

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-28 00:58

    How about:

    watch 'ping -c 4 www.google.com; echo; ping -c 4 www.yahoo.com'

    Gives result such as this:

    Every 2.0s: ping -c 4 www.google.com; echo; ping -c 4 www.yahoo.com                                                                          Tue Apr  7 13:57:47 2009
    
    PING www.l.google.com (74.125.39.105) 56(84) bytes of data.
    64 bytes from fx-in-f105.google.com (74.125.39.105): icmp_seq=1 ttl=248 time=8.06 ms
    64 bytes from fx-in-f105.google.com (74.125.39.105): icmp_seq=2 ttl=248 time=8.47 ms
    64 bytes from fx-in-f105.google.com (74.125.39.105): icmp_seq=3 ttl=248 time=8.37 ms
    64 bytes from fx-in-f105.google.com (74.125.39.105): icmp_seq=4 ttl=248 time=8.19 ms
    
    --- www.l.google.com ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 2999ms
    rtt min/avg/max/mdev = 8.061/8.276/8.478/0.196 ms
    
    PING www-real.wa1.b.yahoo.com (87.248.113.14) 56(84) bytes of data.
    64 bytes from f1.us.www.vip.ird.yahoo.com (87.248.113.14): icmp_seq=1 ttl=56 time=43.3 ms
    64 bytes from f1.us.www.vip.ird.yahoo.com (87.248.113.14): icmp_seq=2 ttl=56 time=44.3 ms
    64 bytes from f1.us.www.vip.ird.yahoo.com (87.248.113.14): icmp_seq=3 ttl=56 time=42.4 ms
    64 bytes from f1.us.www.vip.ird.yahoo.com (87.248.113.14): icmp_seq=4 ttl=56 time=43.0 ms
    
    --- www-real.wa1.b.yahoo.com ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 2999ms
    rtt min/avg/max/mdev = 42.422/43.277/44.301/0.728 ms
    

    Do you need to subtract the ping times? Does it have to be side by side (a bit annoying)? What's your ideal output format?

提交回复
热议问题