Skip to content

Commit

Permalink
Trace current PeerGSV in AddSample
Browse files Browse the repository at this point in the history
  • Loading branch information
karknu committed Jul 1, 2020
1 parent f4d84ef commit 5f74eaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions ouroboros-network/src/Ouroboros/Network/KeepAlive.hs
Expand Up @@ -29,10 +29,11 @@ import Ouroboros.Network.Protocol.KeepAlive.Server
newtype KeepAliveInterval = KeepAliveInterval { keepAliveInterval :: DiffTime }

data TraceKeepAliveClient peer =
AddSample peer DiffTime
AddSample peer DiffTime PeerGSV

instance Show peer => Show (TraceKeepAliveClient peer) where
show (AddSample peer rtt) = "AddSample " ++ show peer ++ show rtt
show (AddSample peer rtt gsv) = "AddSample " ++ show peer ++ " sample: " ++ show rtt
++ " gsv: " ++ show gsv

keepAliveClient
:: forall m peer.
Expand Down Expand Up @@ -62,8 +63,10 @@ keepAliveClient tracer peer dqCtx KeepAliveInterval { keepAliveInterval } startT
startTime_m <- atomically $ readTVar startTimeV
case startTime_m of
Just startTime -> do
traceWith tracer $ AddSample peer $ diffTime endTime startTime
let sample = fromSample startTime endTime payloadSize
let rtt = diffTime endTime startTime
sample = fromSample startTime endTime payloadSize

traceWith tracer $ AddSample peer rtt sample
atomically $ modifyTVar dqCtx $ \m ->
assert (peer `M.member` m) $
M.adjust (\a -> a <> sample) peer m
Expand Down
Expand Up @@ -178,10 +178,11 @@ sampleBlockFetchPolicy1 blockHeap currentChain candidateChains =
--
exampleFixedPeerGSVs :: PeerGSV
exampleFixedPeerGSVs =
PeerGSV{outboundGSV, inboundGSV}
PeerGSV{sampleTime, outboundGSV, inboundGSV}
where
inboundGSV = ballisticGSV 10e-3 10e-6 (degenerateDistribution 0)
outboundGSV = inboundGSV
sampleTime = Time 0


--
Expand Down

0 comments on commit 5f74eaf

Please sign in to comment.