From 93f5d1ef7fdeeea869e8a827adba8bff1852e4ad Mon Sep 17 00:00:00 2001 From: Waldemar Zimpel Date: Wed, 23 Oct 2024 02:51:26 +0200 Subject: [PATCH] Log average transfer rate Adds the average transfer rate for the summary interval to the summary log lines --- common/event/interface.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/event/interface.go b/common/event/interface.go index c3abd97..38dd6d7 100644 --- a/common/event/interface.go +++ b/common/event/interface.go @@ -86,8 +86,10 @@ type EventOnProxyStats struct { } func (e EventOnProxyStats) String() string { - statString := fmt.Sprintf("In the last %v, there were %v completed connections. Traffic Relayed ↓ %v %v, ↑ %v %v.", - e.SummaryInterval.String(), e.ConnectionCount, e.InboundBytes, e.InboundUnit, e.OutboundBytes, e.OutboundUnit) + statString := fmt.Sprintf("In the last %v, there were %v completed connections. Traffic Relayed ↓ %v %v (%.2f %v%s), ↑ %v %v (%.2f %v%s).", + e.SummaryInterval.String(), e.ConnectionCount, + e.InboundBytes, e.InboundUnit, float64(e.InboundBytes)/e.SummaryInterval.Seconds(), e.InboundUnit, "/s", + e.OutboundBytes, e.OutboundUnit, float64(e.OutboundBytes)/e.SummaryInterval.Seconds(), e.OutboundUnit, "/s") return statString }