Expose smoothed RTT and RTT variance measurements to userland via
socket option TCP_INFO. Note that the units used in the original Linux API are in microseconds, so use a 64-bit mantissa to convert FreeBSD's internal measurements from struct tcpcb from ticks.
This commit is contained in:
parent
e8117c82f6
commit
1baaf8347c
@ -208,8 +208,8 @@ struct tcp_info {
|
||||
/* Metrics; variable units. */
|
||||
u_int32_t __tcpi_pmtu;
|
||||
u_int32_t __tcpi_rcv_ssthresh;
|
||||
u_int32_t __tcpi_rtt;
|
||||
u_int32_t __tcpi_rttvar;
|
||||
u_int32_t tcpi_rtt; /* Smoothed RTT in usecs. */
|
||||
u_int32_t tcpi_rttvar; /* RTT variance in usecs. */
|
||||
u_int32_t tcpi_snd_ssthresh; /* Slow start threshold. */
|
||||
u_int32_t tcpi_snd_cwnd; /* Send congestion window. */
|
||||
u_int32_t __tcpi_advmss;
|
||||
|
@ -1245,6 +1245,10 @@ tcp_fill_info(tp, ti)
|
||||
ti->tcpi_snd_wscale = tp->snd_scale;
|
||||
ti->tcpi_rcv_wscale = tp->rcv_scale;
|
||||
}
|
||||
|
||||
ti->tcpi_rtt = ((u_int64_t)tp->t_srtt * tick) >> TCP_RTT_SHIFT;
|
||||
ti->tcpi_rttvar = ((u_int64_t)tp->t_rttvar * tick) >> TCP_RTTVAR_SHIFT;
|
||||
|
||||
ti->tcpi_snd_ssthresh = tp->snd_ssthresh;
|
||||
ti->tcpi_snd_cwnd = tp->snd_cwnd;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user