mirror of https://github.com/tailscale/tailscale/
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>pull/7928/head
parent
7f057d7489
commit
7c386ca6d2
Loading…
Reference in New Issue