From c744c6cecd4f049ce5a2f6e922ca9f74b03fa3a3 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Mon, 20 Oct 2014 12:18:48 -0400 Subject: [PATCH] 3826: Fix confusing reuse of variable name. --- services/crunchstat/crunchstat.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/crunchstat/crunchstat.go b/services/crunchstat/crunchstat.go index 91027d7677..728f1a4374 100644 --- a/services/crunchstat/crunchstat.go +++ b/services/crunchstat/crunchstat.go @@ -242,12 +242,12 @@ func DoNetworkStats(cgroup Cgroup, lastSample map[string]IoSample) { nextSample.txBytes = tx nextSample.rxBytes = rx var delta string - if lastSample, ok := lastSample[ifName]; ok { - interval := nextSample.sampleTime.Sub(lastSample.sampleTime).Seconds() + if prev, ok := lastSample[ifName]; ok { + interval := nextSample.sampleTime.Sub(prev.sampleTime).Seconds() delta = fmt.Sprintf(" -- interval %.4f seconds %d tx %d rx", interval, - tx-lastSample.txBytes, - rx-lastSample.rxBytes) + tx-prev.txBytes, + rx-prev.rxBytes) } LogPrintf("net:%s %d tx %d rx%s", ifName, tx, rx, delta) lastSample[ifName] = nextSample -- 2.39.5