Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-flow-metrics
Commits
a0a12174
Commit
a0a12174
authored
Oct 31, 2019
by
Roman Proskuryakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Meter::Reset method
parent
eca53f81
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
meter.go
meter.go
+10
-0
No files found.
meter.go
View file @
a0a12174
...
...
@@ -53,6 +53,16 @@ func (m *Meter) Snapshot() Snapshot {
return
m
.
snapshot
}
// Reset sets accumulator, total and rate to zero and last update to current time.
func
(
m
*
Meter
)
Reset
()
{
globalSweeper
.
snapshotMu
.
Lock
()
defer
globalSweeper
.
snapshotMu
.
Unlock
()
atomic
.
StoreUint64
(
&
m
.
accumulator
,
0
)
m
.
snapshot
.
Rate
=
0
m
.
snapshot
.
Total
=
0
m
.
snapshot
.
LastUpdate
=
time
.
Now
()
}
func
(
m
*
Meter
)
String
()
string
{
return
m
.
Snapshot
()
.
String
()
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment