ping time fluctuates, any idea?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ping time fluctuates, any idea?

Jihyun Yu
It seems that time from ping command fluctuates. Here's a output from ping
command.

# ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.058 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=255 time=0.035 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=255 time=0.047 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=255 time=0.050 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=255 time=0.047 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=255 time=0.052 ms
64 bytes from 127.0.0.1: icmp_seq=6 ttl=255 time=0.051 ms
64 bytes from 127.0.0.1: icmp_seq=7 ttl=255 time=0.034 ms
64 bytes from 127.0.0.1: icmp_seq=8 ttl=255 time=0.054 ms
64 bytes from 127.0.0.1: icmp_seq=9 ttl=255 time=0.052 ms
64 bytes from 127.0.0.1: icmp_seq=10 ttl=255 time=0.035 ms
64 bytes from 127.0.0.1: icmp_seq=11 ttl=255 time=0.051 ms
64 bytes from 127.0.0.1: icmp_seq=12 ttl=255 time=0.033 ms
64 bytes from 127.0.0.1: icmp_seq=13 ttl=255 time=0.048 ms
64 bytes from 127.0.0.1: icmp_seq=14 ttl=255 time=0.053 ms
64 bytes from 127.0.0.1: icmp_seq=15 ttl=255 time=0.049 ms
64 bytes from 127.0.0.1: icmp_seq=16 ttl=255 time=0.050 ms
64 bytes from 127.0.0.1: icmp_seq=17 ttl=255 time=0.051 ms
64 bytes from 127.0.0.1: icmp_seq=18 ttl=255 time=587.470 ms
64 bytes from 127.0.0.1: icmp_seq=19 ttl=255 time=0.047 ms
64 bytes from 127.0.0.1: icmp_seq=20 ttl=255 time=0.063 ms
64 bytes from 127.0.0.1: icmp_seq=21 ttl=255 time=0.066 ms
64 bytes from 127.0.0.1: icmp_seq=22 ttl=255 time=0.052 ms
64 bytes from 127.0.0.1: icmp_seq=23 ttl=255 time=0.055 ms
64 bytes from 127.0.0.1: icmp_seq=24 ttl=255 time=0.035 ms
64 bytes from 127.0.0.1: icmp_seq=25 ttl=255 time=0.034 ms
64 bytes from 127.0.0.1: icmp_seq=26 ttl=255 time=0.057 ms
64 bytes from 127.0.0.1: icmp_seq=27 ttl=255 time=0.057 ms
64 bytes from 127.0.0.1: icmp_seq=28 ttl=255 time=0.057 ms
64 bytes from 127.0.0.1: icmp_seq=29 ttl=255 time=0.057 ms
64 bytes from 127.0.0.1: icmp_seq=30 ttl=255 time=0.058 ms
64 bytes from 127.0.0.1: icmp_seq=31 ttl=255 time=0.059 ms
64 bytes from 127.0.0.1: icmp_seq=32 ttl=255 time=0.058 ms
64 bytes from 127.0.0.1: icmp_seq=33 ttl=255 time=0.057 ms
64 bytes from 127.0.0.1: icmp_seq=34 ttl=255 time=0.055 ms
64 bytes from 127.0.0.1: icmp_seq=35 ttl=255 time=-587.359 ms

At first, I suspect that system time fluctuates for some reasons. To test
it, I wrote a simple python scripts to detect local time changes.

# cat test.py
import time

def milliseconds():
    return int(round(time.time() * 1000))

prev = milliseconds()
while True:
    cur = milliseconds()
    dt = cur - prev
    if dt < 0:
        print("prev=%s, cur=%s, diff=%s" % (prev, cur, dt))
    prev = cur
# python3 test.py

I validated the script with `rdate` command, and it works as expected.
However it does not print logs on ping time fluctuations.

Any hint to troubleshoot the issue? Here's my dmesg.

 00=2828 01=a1a1 02=f7f7 03=2020 04=d9d9 05=5b5b 06=0b0b 07=3030
isa0 at pcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
wbsio0 at isa0 port 0x2e/2: NCT6776F rev 0x33
lm1 at wbsio0 port 0x290/8: NCT6776F
pci13 at mainbus0 bus 255
"Intel E5 QPI Link" rev 0x07 at pci13 dev 8 function 0 not configured
vendor "Intel", unknown product 0x3c83 (class system subclass
miscellaneous, rev 0x07) at pci13 dev 8 function 3 not configured
vendor "Intel", unknown product 0x3c84 (class system subclass
miscellaneous, rev 0x07) at pci13 dev 8 function 4 not configured
"Intel E5 QPI Link" rev 0x07 at pci13 dev 9 function 0 not configured
vendor "Intel", unknown product 0x3c93 (class system subclass
miscellaneous, rev 0x07) at pci13 dev 9 function 3 not configured
vendor "Intel", unknown product 0x3c94 (class system subclass
miscellaneous, rev 0x07) at pci13 dev 9 function 4 not configured
"Intel E5 PCU" rev 0x07 at pci13 dev 10 function 0 not configured
"Intel E5 PCU" rev 0x07 at pci13 dev 10 function 1 not configured
"Intel E5 PCU" rev 0x07 at pci13 dev 10 function 2 not configured
"Intel E5 PCU" rev 0x07 at pci13 dev 10 function 3 not configured
"Intel E5 Scratch" rev 0x07 at pci13 dev 11 function 0 not configured
"Intel E5 Scratch" rev 0x07 at pci13 dev 11 function 3 not configured
"Intel E5 Unicast" rev 0x07 at pci13 dev 12 function 0 not configured
"Intel E5 Unicast" rev 0x07 at pci13 dev 12 function 1 not configured
"Intel E5 Unicast" rev 0x07 at pci13 dev 12 function 2 not configured
"Intel E5 SAD" rev 0x07 at pci13 dev 12 function 6 not configured
"Intel E5 SAD" rev 0x07 at pci13 dev 12 function 7 not configured
"Intel E5 Unicast" rev 0x07 at pci13 dev 13 function 0 not configured
"Intel E5 Unicast" rev 0x07 at pci13 dev 13 function 1 not configured
"Intel E5 Unicast" rev 0x07 at pci13 dev 13 function 2 not configured
"Intel E5 Broadcast" rev 0x07 at pci13 dev 13 function 6 not configured
"Intel E5 Home Agent" rev 0x07 at pci13 dev 14 function 0 not configured
"Intel E5 Home Agent" rev 0x07 at pci13 dev 14 function 1 not configured
"Intel E5 TA" rev 0x07 at pci13 dev 15 function 0 not configured
"Intel E5 RAS" rev 0x07 at pci13 dev 15 function 1 not configured
"Intel E5 TAD" rev 0x07 at pci13 dev 15 function 2 not configured
"Intel E5 TAD" rev 0x07 at pci13 dev 15 function 3 not configured
"Intel E5 TAD" rev 0x07 at pci13 dev 15 function 4 not configured
"Intel E5 TAD" rev 0x07 at pci13 dev 15 function 5 not configured
"Intel E5 TAD" rev 0x07 at pci13 dev 15 function 6 not configured
"Intel E5 Thermal" rev 0x07 at pci13 dev 16 function 0 not configured
"Intel E5 Thermal" rev 0x07 at pci13 dev 16 function 1 not configured
"Intel E5 Error" rev 0x07 at pci13 dev 16 function 2 not configured
"Intel E5 Error" rev 0x07 at pci13 dev 16 function 3 not configured
"Intel E5 Thermal" rev 0x07 at pci13 dev 16 function 4 not configured
"Intel E5 Thermal" rev 0x07 at pci13 dev 16 function 5 not configured
"Intel E5 Error" rev 0x07 at pci13 dev 16 function 6 not configured
"Intel E5 Error" rev 0x07 at pci13 dev 16 function 7 not configured
"Intel E5 DDRIO" rev 0x07 at pci13 dev 17 function 0 not configured
"Intel E5 R2PCIE" rev 0x07 at pci13 dev 19 function 0 not configured
"Intel E5 PCIE Monitor" rev 0x07 at pci13 dev 19 function 1 not configured
"Intel E5 QPI" rev 0x07 at pci13 dev 19 function 4 not configured
"Intel E5 QPI Link Monitor" rev 0x07 at pci13 dev 19 function 5 not
configured
"Intel E5 QPI Link Monitor" rev 0x07 at pci13 dev 19 function 6 not
configured
vmm0 at mainbus0: VMX/EPT
uhub4 at uhub0 port 1 configuration 1 interface 0 "Intel Rate Matching Hub"
rev 2.00/0.00 addr 2
uhub5 at uhub3 port 1 configuration 1 interface 0 "Intel Rate Matching Hub"
rev 2.00/0.00 addr 2
vscsi0 at root
scsibus4 at vscsi0: 256 targets
softraid0 at root
scsibus5 at softraid0: 256 targets
root on sd0a (74fd07b06a4f30a1.a) swap on sd0b dump on sd0b


Thanks,
Jihyun Yu
Reply | Threaded
Open this post in threaded view
|

Re: ping time fluctuates, any idea?

Richard Procter
Hello,

> On 9/09/2019, at 8:45 PM, Jihyun Yu <[hidden email]> wrote:
>
> It seems that time from ping command fluctuates. Here's a output from ping
> command.
> [...snip ping with negative rtt...]

This is symptomatic of unsynchronized time stamp counters (TSC).

I would expect that setting:

# sysctl kern.timecounter.hardware=acpihpet0

would fix your ping results, and probably improve your ntpd(8)
performance, too.

There has been some work in this area on -current.

best,
Richard.

PS. Please make sure to include a complete dmesg next time -  
half a dmesg is like half a photograph!

> 00=2828 01=a1a1 02=f7f7 03=2020 04=d9d9 05=5b5b 06=0b0b 07=3030
> isa0 at pcib0
> isadma0 at isa0
> com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
> pckbc0 at isa0 port 0x60/5 irq 1 irq 12
> pckbd0 at pckbc0 (kbd slot)
> wskbd0 at pckbd0: console keyboard, using wsdisplay0
> pcppi0 at isa0 port 0x61
> spkr0 at pcppi0
> wbsio0 at isa0 port 0x2e/2: NCT6776F rev 0x33
> lm1 at wbsio0 port 0x290/8: NCT6776F
> pci13 at mainbus0 bus 255
> "Intel E5 QPI Link" rev 0x07 at pci13 dev 8 function 0 not configured
> vendor "Intel", unknown product 0x3c83 (class system subclass
> miscellaneous, rev 0x07) at pci13 dev 8 function 3 not configured
> vendor "Intel", unknown product 0x3c84 (class system subclass
> miscellaneous, rev 0x07) at pci13 dev 8 function 4 not configured
> "Intel E5 QPI Link" rev 0x07 at pci13 dev 9 function 0 not configured
> vendor "Intel", unknown product 0x3c93 (class system subclass
> miscellaneous, rev 0x07) at pci13 dev 9 function 3 not configured
> vendor "Intel", unknown product 0x3c94 (class system subclass
> miscellaneous, rev 0x07) at pci13 dev 9 function 4 not configured
> "Intel E5 PCU" rev 0x07 at pci13 dev 10 function 0 not configured
> "Intel E5 PCU" rev 0x07 at pci13 dev 10 function 1 not configured
> "Intel E5 PCU" rev 0x07 at pci13 dev 10 function 2 not configured
> "Intel E5 PCU" rev 0x07 at pci13 dev 10 function 3 not configured
> "Intel E5 Scratch" rev 0x07 at pci13 dev 11 function 0 not configured
> "Intel E5 Scratch" rev 0x07 at pci13 dev 11 function 3 not configured
> "Intel E5 Unicast" rev 0x07 at pci13 dev 12 function 0 not configured
> "Intel E5 Unicast" rev 0x07 at pci13 dev 12 function 1 not configured
> "Intel E5 Unicast" rev 0x07 at pci13 dev 12 function 2 not configured
> "Intel E5 SAD" rev 0x07 at pci13 dev 12 function 6 not configured
> "Intel E5 SAD" rev 0x07 at pci13 dev 12 function 7 not configured
> "Intel E5 Unicast" rev 0x07 at pci13 dev 13 function 0 not configured
> "Intel E5 Unicast" rev 0x07 at pci13 dev 13 function 1 not configured
> "Intel E5 Unicast" rev 0x07 at pci13 dev 13 function 2 not configured
> "Intel E5 Broadcast" rev 0x07 at pci13 dev 13 function 6 not configured
> "Intel E5 Home Agent" rev 0x07 at pci13 dev 14 function 0 not configured
> "Intel E5 Home Agent" rev 0x07 at pci13 dev 14 function 1 not configured
> "Intel E5 TA" rev 0x07 at pci13 dev 15 function 0 not configured
> "Intel E5 RAS" rev 0x07 at pci13 dev 15 function 1 not configured
> "Intel E5 TAD" rev 0x07 at pci13 dev 15 function 2 not configured
> "Intel E5 TAD" rev 0x07 at pci13 dev 15 function 3 not configured
> "Intel E5 TAD" rev 0x07 at pci13 dev 15 function 4 not configured
> "Intel E5 TAD" rev 0x07 at pci13 dev 15 function 5 not configured
> "Intel E5 TAD" rev 0x07 at pci13 dev 15 function 6 not configured
> "Intel E5 Thermal" rev 0x07 at pci13 dev 16 function 0 not configured
> "Intel E5 Thermal" rev 0x07 at pci13 dev 16 function 1 not configured
> "Intel E5 Error" rev 0x07 at pci13 dev 16 function 2 not configured
> "Intel E5 Error" rev 0x07 at pci13 dev 16 function 3 not configured
> "Intel E5 Thermal" rev 0x07 at pci13 dev 16 function 4 not configured
> "Intel E5 Thermal" rev 0x07 at pci13 dev 16 function 5 not configured
> "Intel E5 Error" rev 0x07 at pci13 dev 16 function 6 not configured
> "Intel E5 Error" rev 0x07 at pci13 dev 16 function 7 not configured
> "Intel E5 DDRIO" rev 0x07 at pci13 dev 17 function 0 not configured
> "Intel E5 R2PCIE" rev 0x07 at pci13 dev 19 function 0 not configured
> "Intel E5 PCIE Monitor" rev 0x07 at pci13 dev 19 function 1 not configured
> "Intel E5 QPI" rev 0x07 at pci13 dev 19 function 4 not configured
> "Intel E5 QPI Link Monitor" rev 0x07 at pci13 dev 19 function 5 not
> configured
> "Intel E5 QPI Link Monitor" rev 0x07 at pci13 dev 19 function 6 not
> configured
> vmm0 at mainbus0: VMX/EPT
> uhub4 at uhub0 port 1 configuration 1 interface 0 "Intel Rate Matching Hub"
> rev 2.00/0.00 addr 2
> uhub5 at uhub3 port 1 configuration 1 interface 0 "Intel Rate Matching Hub"
> rev 2.00/0.00 addr 2
> vscsi0 at root
> scsibus4 at vscsi0: 256 targets
> softraid0 at root
> scsibus5 at softraid0: 256 targets
> root on sd0a (74fd07b06a4f30a1.a) swap on sd0b dump on sd0b
>
>
> Thanks,
> Jihyun Yu

Reply | Threaded
Open this post in threaded view
|

Re: ping time fluctuates, any idea?

Jihyun Yu
It does fixes the problem, thanks for the help!
I'll make sure to include full dmesg next time

Thanks,

On Tue, Sep 10, 2019 at 12:23 PM Richard Procter <
[hidden email]> wrote:

> Hello,
>
> > On 9/09/2019, at 8:45 PM, Jihyun Yu <[hidden email]> wrote:
> >
> > It seems that time from ping command fluctuates. Here's a output from
> ping
> > command.
> > [...snip ping with negative rtt...]
>
> This is symptomatic of unsynchronized time stamp counters (TSC).
>
> I would expect that setting:
>
> # sysctl kern.timecounter.hardware=acpihpet0
>
> would fix your ping results, and probably improve your ntpd(8)
> performance, too.
>
> There has been some work in this area on -current.
>
> best,
> Richard.
>
> PS. Please make sure to include a complete dmesg next time -
> half a dmesg is like half a photograph!
>
> > 00=2828 01=a1a1 02=f7f7 03=2020 04=d9d9 05=5b5b 06=0b0b 07=3030
> > isa0 at pcib0
> > isadma0 at isa0
> > com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
> > pckbc0 at isa0 port 0x60/5 irq 1 irq 12
> > pckbd0 at pckbc0 (kbd slot)
> > wskbd0 at pckbd0: console keyboard, using wsdisplay0
> > pcppi0 at isa0 port 0x61
> > spkr0 at pcppi0
> > wbsio0 at isa0 port 0x2e/2: NCT6776F rev 0x33
> > lm1 at wbsio0 port 0x290/8: NCT6776F
> > pci13 at mainbus0 bus 255
> > "Intel E5 QPI Link" rev 0x07 at pci13 dev 8 function 0 not configured
> > vendor "Intel", unknown product 0x3c83 (class system subclass
> > miscellaneous, rev 0x07) at pci13 dev 8 function 3 not configured
> > vendor "Intel", unknown product 0x3c84 (class system subclass
> > miscellaneous, rev 0x07) at pci13 dev 8 function 4 not configured
> > "Intel E5 QPI Link" rev 0x07 at pci13 dev 9 function 0 not configured
> > vendor "Intel", unknown product 0x3c93 (class system subclass
> > miscellaneous, rev 0x07) at pci13 dev 9 function 3 not configured
> > vendor "Intel", unknown product 0x3c94 (class system subclass
> > miscellaneous, rev 0x07) at pci13 dev 9 function 4 not configured
> > "Intel E5 PCU" rev 0x07 at pci13 dev 10 function 0 not configured
> > "Intel E5 PCU" rev 0x07 at pci13 dev 10 function 1 not configured
> > "Intel E5 PCU" rev 0x07 at pci13 dev 10 function 2 not configured
> > "Intel E5 PCU" rev 0x07 at pci13 dev 10 function 3 not configured
> > "Intel E5 Scratch" rev 0x07 at pci13 dev 11 function 0 not configured
> > "Intel E5 Scratch" rev 0x07 at pci13 dev 11 function 3 not configured
> > "Intel E5 Unicast" rev 0x07 at pci13 dev 12 function 0 not configured
> > "Intel E5 Unicast" rev 0x07 at pci13 dev 12 function 1 not configured
> > "Intel E5 Unicast" rev 0x07 at pci13 dev 12 function 2 not configured
> > "Intel E5 SAD" rev 0x07 at pci13 dev 12 function 6 not configured
> > "Intel E5 SAD" rev 0x07 at pci13 dev 12 function 7 not configured
> > "Intel E5 Unicast" rev 0x07 at pci13 dev 13 function 0 not configured
> > "Intel E5 Unicast" rev 0x07 at pci13 dev 13 function 1 not configured
> > "Intel E5 Unicast" rev 0x07 at pci13 dev 13 function 2 not configured
> > "Intel E5 Broadcast" rev 0x07 at pci13 dev 13 function 6 not configured
> > "Intel E5 Home Agent" rev 0x07 at pci13 dev 14 function 0 not configured
> > "Intel E5 Home Agent" rev 0x07 at pci13 dev 14 function 1 not configured
> > "Intel E5 TA" rev 0x07 at pci13 dev 15 function 0 not configured
> > "Intel E5 RAS" rev 0x07 at pci13 dev 15 function 1 not configured
> > "Intel E5 TAD" rev 0x07 at pci13 dev 15 function 2 not configured
> > "Intel E5 TAD" rev 0x07 at pci13 dev 15 function 3 not configured
> > "Intel E5 TAD" rev 0x07 at pci13 dev 15 function 4 not configured
> > "Intel E5 TAD" rev 0x07 at pci13 dev 15 function 5 not configured
> > "Intel E5 TAD" rev 0x07 at pci13 dev 15 function 6 not configured
> > "Intel E5 Thermal" rev 0x07 at pci13 dev 16 function 0 not configured
> > "Intel E5 Thermal" rev 0x07 at pci13 dev 16 function 1 not configured
> > "Intel E5 Error" rev 0x07 at pci13 dev 16 function 2 not configured
> > "Intel E5 Error" rev 0x07 at pci13 dev 16 function 3 not configured
> > "Intel E5 Thermal" rev 0x07 at pci13 dev 16 function 4 not configured
> > "Intel E5 Thermal" rev 0x07 at pci13 dev 16 function 5 not configured
> > "Intel E5 Error" rev 0x07 at pci13 dev 16 function 6 not configured
> > "Intel E5 Error" rev 0x07 at pci13 dev 16 function 7 not configured
> > "Intel E5 DDRIO" rev 0x07 at pci13 dev 17 function 0 not configured
> > "Intel E5 R2PCIE" rev 0x07 at pci13 dev 19 function 0 not configured
> > "Intel E5 PCIE Monitor" rev 0x07 at pci13 dev 19 function 1 not
> configured
> > "Intel E5 QPI" rev 0x07 at pci13 dev 19 function 4 not configured
> > "Intel E5 QPI Link Monitor" rev 0x07 at pci13 dev 19 function 5 not
> > configured
> > "Intel E5 QPI Link Monitor" rev 0x07 at pci13 dev 19 function 6 not
> > configured
> > vmm0 at mainbus0: VMX/EPT
> > uhub4 at uhub0 port 1 configuration 1 interface 0 "Intel Rate Matching
> Hub"
> > rev 2.00/0.00 addr 2
> > uhub5 at uhub3 port 1 configuration 1 interface 0 "Intel Rate Matching
> Hub"
> > rev 2.00/0.00 addr 2
> > vscsi0 at root
> > scsibus4 at vscsi0: 256 targets
> > softraid0 at root
> > scsibus5 at softraid0: 256 targets
> > root on sd0a (74fd07b06a4f30a1.a) swap on sd0b dump on sd0b
> >
> >
> > Thanks,
> > Jihyun Yu
>
>