summaryrefslogtreecommitdiff
path: root/extendedstats/unix.go
diff options
context:
space:
mode:
authorWill Hawkins <[email protected]>2022-06-17 18:36:39 -0400
committerWill Hawkins <[email protected]>2022-06-17 18:41:10 -0400
commit71d9bae3dc95faa17764993c437116cd9544c624 (patch)
tree33d0cbca76c033b347833b5996c7360e83c7d776 /extendedstats/unix.go
parente752ba23b75628697dbcf3c3d932ffa663306f15 (diff)
[Feature] Expose send/recv mss, and reorderings in extended stats
@moeller1 requested additional stats on the *nix platforms. Subsequent patch will enable the same statistics on macOS.
Diffstat (limited to 'extendedstats/unix.go')
-rw-r--r--extendedstats/unix.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/extendedstats/unix.go b/extendedstats/unix.go
index fb4a2c8..1448368 100644
--- a/extendedstats/unix.go
+++ b/extendedstats/unix.go
@@ -14,7 +14,10 @@ import (
type ExtendedStats struct {
MaxPathMtu uint64
+ MaxSendMss uint64
+ MaxRecvMss uint64
TotalRetransmissions uint64
+ TotalReorderings uint64
AverageRtt float64
rtt_measurements uint64
total_rtt float64
@@ -37,8 +40,11 @@ func (es *ExtendedStats) IncorporateConnectionStats(rawConn net.Conn) error {
return fmt.Errorf("OOPS: Could not get the TCP info for the connection: %v!\n", err)
} else {
es.MaxPathMtu = utilities.Max(es.MaxPathMtu, uint64(info.Pmtu))
+ es.MaxRecvMss = utilities.Max(es.MaxRecvMss, uint64(info.Rcv_mss))
+ es.MaxSendMss = utilities.Max(es.MaxSendMss, uint64(info.Snd_mss))
// https://lkml.iu.edu/hypermail/linux/kernel/1705.0/01790.html
es.TotalRetransmissions += uint64(info.Total_retrans)
+ es.TotalReorderings += uint64(info.Reordering)
es.total_rtt += float64(info.Rtt)
es.rtt_measurements += 1
es.AverageRtt = es.total_rtt / float64(es.rtt_measurements)
@@ -49,9 +55,12 @@ func (es *ExtendedStats) IncorporateConnectionStats(rawConn net.Conn) error {
func (es *ExtendedStats) Repr() string {
return fmt.Sprintf(`Extended Statistics:
Maximum Path MTU: %v
+ Maximum Send MSS: %v
+ Maximum Recv MSS: %v
Total Retransmissions: %v
+ Total Reorderings: %v
Average RTT: %v
-`, es.MaxPathMtu, es.TotalRetransmissions, es.AverageRtt)
+`, es.MaxPathMtu, es.MaxSendMss, es.MaxRecvMss, es.TotalRetransmissions, es.TotalReorderings, es.AverageRtt)
}
func getTCPInfo(connection net.Conn) (*unix.TCPInfo, error) {