Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: go/metrics2/counter.go

Issue 1682363003: Migrate fuzzer to use shiny new metrics2 package (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« fuzzer/sys/fuzzer-be.service ('K') | « fuzzer/sys/fuzzer-fe.service ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package metrics2 1 package metrics2
2 2
3 import "sync" 3 import "sync"
4 4
5 const ( 5 const (
6 MEASUREMENT_COUNTER = "counter" 6 MEASUREMENT_COUNTER = "counter"
7 ) 7 )
8 8
9 // Counter is a struct used for tracking metrics which increment or decrement. 9 // Counter is a struct used for tracking metrics which increment or decrement.
10 type Counter struct { 10 type Counter struct {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 defer c.mtx.Unlock() 44 defer c.mtx.Unlock()
45 c.m.Update(c.m.Get() - i) 45 c.m.Update(c.m.Get() - i)
46 } 46 }
47 47
48 // Reset sets the counter to zero. 48 // Reset sets the counter to zero.
49 func (c *Counter) Reset() { 49 func (c *Counter) Reset() {
50 c.mtx.Lock() 50 c.mtx.Lock()
51 defer c.mtx.Unlock() 51 defer c.mtx.Unlock()
52 c.m.Update(0) 52 c.m.Update(0)
53 } 53 }
54
55 // Count returns the current value in the counter.
56 func (c *Counter) Count() int64 {
borenet 2016/02/10 15:32:32 For consistency, let's just call this Get()
kjlubick 2016/02/10 16:14:29 Done.
57 c.mtx.Lock()
58 defer c.mtx.Unlock()
59 return c.m.Get()
60 }
OLDNEW
« fuzzer/sys/fuzzer-be.service ('K') | « fuzzer/sys/fuzzer-fe.service ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698