@@ -103,6 +103,8 @@ data DiffusionData = DiffusionData
103103 -- ^ adoption latency, counted from slot start.
104104 , stable_chain_hashes :: [Int ]
105105 , average_latencies :: Map. Map Double DiffTime
106+ , average_block_fetch_duration :: DiffTime
107+ -- ^ for comparison with benchmark cluster measurement.
106108 }
107109 deriving (Generic , ToJSON , FromJSON )
108110
@@ -165,7 +167,7 @@ diffusionSampleModel p2pTopography fp = SampleModel initState accum render
165167 | l <- latency_per_stake
166168 , (Just d, p) <- l. latencies
167169 ]
168- let timesDiff [t0] [t1] = ( realToFrac t1 - realToFrac t0 :: Pico )
170+ let timesDiff [t0] [t1] = realToFrac t1 - realToFrac t0 :: Pico
169171 timesDiff _ _ = undefined
170172 let durations =
171173 Map. intersectionWith
@@ -174,30 +176,33 @@ diffusionSampleModel p2pTopography fp = SampleModel initState accum render
174176 fetchRequests
175177 receivedBodies
176178 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
182184 let diffusionData =
183185 DiffusionData
184186 { topography_details = p2pTopography
185187 , entries
186188 , latency_per_stake
187189 , stable_chain_hashes
188190 , average_latencies
191+ , average_block_fetch_duration
189192 }
190193
191194 encodeFile fp diffusionData
195+ report diffusionData
196+ report diffusionData = do
192197 putStrLn $ " Diffusion data written to " ++ fp
193198 let arrived98 = unzip [(l. hash, d) | l <- diffusionData. latency_per_stake, (Just d, p) <- l. latencies, p == 0.98 ]
194199 let missing = filter (not . (`elem` fst arrived98)) diffusionData. stable_chain_hashes
195200 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)
197202 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
201206
202207accumFetchRequests :: Map. Map ConcreteHeaderHash (Block BlockBody ) -> Time -> PraosEvent -> Map. Map NodeId (Map. Map ConcreteHeaderHash [DiffTime ]) -> Map. Map NodeId (Map. Map ConcreteHeaderHash [DiffTime ])
203208accumFetchRequests blocks (Time t) (PraosEventTcp (LabelLink from _to (TcpSendMsg (PraosMessage (Right (ProtocolMessage (SomeMessage (MsgRequestRange start end))))) _ _))) =
0 commit comments