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
9002d989
Commit
9002d989
authored
Oct 31, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nit: simplify conditional
parent
edeb2d90
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
meter.go
meter.go
+6
-8
No files found.
meter.go
View file @
9002d989
...
...
@@ -40,14 +40,12 @@ type Meter struct {
// Mark updates the total.
func
(
m
*
Meter
)
Mark
(
count
uint64
)
{
if
count
>
0
{
if
atomic
.
AddUint64
(
&
m
.
accumulator
,
count
)
==
count
{
just_registered
:=
atomic
.
CompareAndSwapInt32
(
&
m
.
registered
,
0
,
1
)
if
just_registered
{
// I'm the first one to bump this above 0.
// Register it.
globalSweeper
.
Register
(
m
)
}
if
count
>
0
&&
atomic
.
AddUint64
(
&
m
.
accumulator
,
count
)
==
count
{
just_registered
:=
atomic
.
CompareAndSwapInt32
(
&
m
.
registered
,
0
,
1
)
if
just_registered
{
// I'm the first one to bump this above 0.
// Register it.
globalSweeper
.
Register
(
m
)
}
}
}
...
...
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