@@ -103,6 +103,8 @@ data DiffusionData = DiffusionData
103
103
-- ^ adoption latency, counted from slot start.
104
104
, stable_chain_hashes :: [Int ]
105
105
, average_latencies :: Map. Map Double DiffTime
106
+ , average_block_fetch_duration :: DiffTime
107
+ -- ^ for comparison with benchmark cluster measurement.
106
108
}
107
109
deriving (Generic , ToJSON , FromJSON )
108
110
@@ -165,7 +167,7 @@ diffusionSampleModel p2pTopography fp = SampleModel initState accum render
165
167
| l <- latency_per_stake
166
168
, (Just d, p) <- l. latencies
167
169
]
168
- let timesDiff [t0] [t1] = ( realToFrac t1 - realToFrac t0 :: Pico )
170
+ let timesDiff [t0] [t1] = realToFrac t1 - realToFrac t0 :: Pico
169
171
timesDiff _ _ = undefined
170
172
let durations =
171
173
Map. intersectionWith
@@ -174,30 +176,33 @@ diffusionSampleModel p2pTopography fp = SampleModel initState accum render
174
176
fetchRequests
175
177
receivedBodies
176
178
let average_block_fetch_duration =
177
- avg $
178
- concatMap Map. elems $
179
- Map. elems $
180
- durations ::
181
- Pico
179
+ realToFrac $
180
+ avg $
181
+ concatMap Map. elems $
182
+ Map. elems $
183
+ durations
182
184
let diffusionData =
183
185
DiffusionData
184
186
{ topography_details = p2pTopography
185
187
, entries
186
188
, latency_per_stake
187
189
, stable_chain_hashes
188
190
, average_latencies
191
+ , average_block_fetch_duration
189
192
}
190
193
191
194
encodeFile fp diffusionData
195
+ report diffusionData
196
+ report diffusionData = do
192
197
putStrLn $ " Diffusion data written to " ++ fp
193
198
let arrived98 = unzip [(l. hash, d) | l <- diffusionData. latency_per_stake, (Just d, p) <- l. latencies, p == 0.98 ]
194
199
let missing = filter (not . (`elem` fst arrived98)) diffusionData. stable_chain_hashes
195
200
putStrLn $ " Number of blocks that reached 98% stake: " ++ show (length $ fst arrived98)
196
- putStrLn $ " with a maximum diffusion latency: " ++ show (maximum $ 0 : snd arrived98)
201
+ putStrLn $ " with a maximum diffusion latency (from slot start) : " ++ show (maximum $ 0 : snd arrived98)
197
202
putStrLn $ " Blocks in longest common prefix that did not reach 98% stake: " ++ show missing
198
- putStrLn $ " Average latencies by percentile"
199
- putStrLn $ unlines $ map show $ Map. toList average_latencies
200
- putStrLn $ " Average block fetch duration: " ++ show average_block_fetch_duration
203
+ putStrLn $ " Average latencies (from slot start) by percentile"
204
+ putStrLn $ unlines $ map show $ Map. toList diffusionData . average_latencies
205
+ putStrLn $ " Average block fetch duration: " ++ show diffusionData . average_block_fetch_duration
201
206
202
207
accumFetchRequests :: Map. Map ConcreteHeaderHash (Block BlockBody ) -> Time -> PraosEvent -> Map. Map NodeId (Map. Map ConcreteHeaderHash [DiffTime ]) -> Map. Map NodeId (Map. Map ConcreteHeaderHash [DiffTime ])
203
208
accumFetchRequests blocks (Time t) (PraosEventTcp (LabelLink from _to (TcpSendMsg (PraosMessage (Right (ProtocolMessage (SomeMessage (MsgRequestRange start end))))) _ _))) =
0 commit comments