MFC: Expose smoothed RTT and RTT variance measurements to userland via

socket option TCP_INFO.
This commit is contained in:
jhb 2008-01-24 21:37:18 +00:00
parent 8534933fd6
commit 681ef96d1c
2 changed files with 6 additions and 2 deletions

View File

@ -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;

View File

@ -988,6 +988,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;