Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
0503c96c
Commit
0503c96c
authored
4 years ago
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
added a mechanisim to get the average latency on round packets received
parent
3ecf3ad6
No related branches found
No related tags found
1 merge request
!23
Release
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
network/follow.go
+33
-2
33 additions, 2 deletions
network/follow.go
network/manager.go
+2
-0
2 additions, 0 deletions
network/manager.go
with
35 additions
and
2 deletions
network/follow.go
+
33
−
2
View file @
0503c96c
...
...
@@ -28,6 +28,7 @@ import (
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/interfaces"
"gitlab.com/elixxir/client/network/rounds"
"gitlab.com/xx_network/primitives/netTime"
pb
"gitlab.com/elixxir/comms/mixmessages"
"gitlab.com/elixxir/primitives/knownRounds"
"gitlab.com/elixxir/primitives/states"
...
...
@@ -63,9 +64,19 @@ func (m *manager) followNetwork(report interfaces.ClientErrorReport, quitCh <-ch
m
.
follow
(
report
,
rng
,
m
.
Comms
,
isRunning
)
case
<-
TrackTicker
.
C
:
numPolls
:=
atomic
.
SwapUint64
(
m
.
tracker
,
0
)
if
m
.
numLatencies
!=
0
{
latencyAvg
:=
time
.
Nanosecond
*
time
.
Duration
(
m
.
latencySum
/
m
.
numLatencies
)
m
.
latencySum
,
m
.
numLatencies
=
0
,
0
jww
.
INFO
.
Printf
(
"Polled the network %d times in the "
+
"last %s, with an average newest packet latency of %s"
,
numPolls
,
debugTrackPeriod
,
latencyAvg
)
}
else
{
jww
.
INFO
.
Printf
(
"Polled the network %d times in the "
+
"last %s"
,
numPolls
,
debugTrackPeriod
)
}
}
if
!
isRunning
.
IsRunning
(){
jww
.
ERROR
.
Printf
(
"Killing network follower "
+
"due to failed exit"
)
...
...
@@ -78,6 +89,7 @@ func (m *manager) followNetwork(report interfaces.ClientErrorReport, quitCh <-ch
func
(
m
*
manager
)
follow
(
report
interfaces
.
ClientErrorReport
,
rng
csprng
.
Source
,
comms
followNetworkComms
,
isRunning
interfaces
.
Running
)
{
//get the identity we will poll for
identity
,
err
:=
m
.
Session
.
Reception
()
.
GetIdentity
(
rng
)
if
err
!=
nil
{
...
...
@@ -114,6 +126,9 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source,
"due to failed exit"
)
return
}
now
:=
netTime
.
Now
()
if
err
!=
nil
{
if
report
!=
nil
{
report
(
...
...
@@ -208,6 +223,22 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source,
}
}
}
newestTS
:=
uint64
(
0
)
for
i
:=
0
;
i
<
len
(
pollResp
.
Updates
[
len
(
pollResp
.
Updates
)
-
1
]
.
Timestamps
);
i
++
{
if
pollResp
.
Updates
[
len
(
pollResp
.
Updates
)
-
1
]
.
Timestamps
[
i
]
!=
0
{
newestTS
=
pollResp
.
Updates
[
len
(
pollResp
.
Updates
)
-
1
]
.
Timestamps
[
i
]
}
}
newest
:=
time
.
Unix
(
0
,
int64
(
newestTS
))
if
newest
.
After
(
now
){
deltaDur
:=
newest
.
Sub
(
now
)
m
.
latencySum
=
uint64
(
deltaDur
)
m
.
numLatencies
++
}
}
// ---- Identity Specific Round Processing -----
...
...
This diff is collapsed.
Click to expand it.
network/manager.go
+
2
−
0
View file @
0503c96c
...
...
@@ -48,6 +48,8 @@ type manager struct {
//number of polls done in a period of time
tracker
*
uint64
latencySum
uint64
numLatencies
uint64
}
// NewManager builds a new reception manager object using inputted key fields
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment