You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/net/sockstats
Will Norris 7c386ca6d2 net/sockstats: fix calculation of radio power usage
When splitting the radio monitor usage array, we were splitting at now %
3600 to get values into chronological order.  This caused the value for
the final second to be included at the beginning of the ordered slice
rather than the end.  If there was activity during that final second, an
extra five seconds of high power usage would get recorded in some cases.
This could result in a final calculation of greater than 100% usage.

This corrects that by splitting values at (now+1 % 3600).

This also simplifies the percentage calculation by always rounding
values down, which is sufficient for our usage.

Signed-off-by: Will Norris <will@tailscale.com>
1 year ago
..
label_string.go sockstats: add labels for netlog and sockstatlog packages 2 years ago
sockstats.go net/sockstats: pass in logger to sockstats.WithSockStats 1 year ago
sockstats_noop.go net/sockstats: pass in logger to sockstats.WithSockStats 1 year ago
sockstats_tsgo.go net/sockstats: fix calculation of radio power usage 1 year ago
sockstats_tsgo_darwin.go sockstats: add validation for TCP socket stats 2 years ago
sockstats_tsgo_test.go net/sockstats: fix calculation of radio power usage 1 year ago