3826: Fix confusing reuse of variable name.
authorTom Clegg <tom@curoverse.com>
Mon, 20 Oct 2014 16:18:48 +0000 (12:18 -0400)
committerTom Clegg <tom@curoverse.com>
Mon, 20 Oct 2014 16:18:48 +0000 (12:18 -0400)
services/crunchstat/crunchstat.go

index 91027d7677b93c04e0efcc7f79dff25d64950d54..728f1a437401798759f184327bec4684649966c8 100644 (file)
@@ -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