@@ -101,8 +101,8 @@ data DiffusionData = DiffusionData
101101 { topography_details :: P2PTopography
102102 , entries :: [DiffusionEntry ]
103103 , latency_per_stake :: [LatencyPerStake ]
104+ -- ^ adoption latency, counted from slot start.
104105 , stable_chain_hashes :: [Int ]
105- , cpuTasks :: Map. Map NodeId [(DiffTime , CPUTask )]
106106 , average_latencies :: Map. Map Double DiffTime
107107 }
108108 deriving (Generic , ToJSON , FromJSON )
@@ -111,16 +111,16 @@ diffusionEntryToLatencyPerStake :: Int -> DiffusionEntry -> LatencyPerStake
111111diffusionEntryToLatencyPerStake nnodes DiffusionEntry {.. } =
112112 LatencyPerStake
113113 { hash
114- , latencies = bin $ diffusionLatencyPerStakeFraction nnodes ( Time created) (map Time arrivals)
114+ , latencies = bin $ diffusionLatencyPerStakeFraction nnodes slotStart (map Time arrivals)
115115 }
116116 where
117+ slotStart = Time $ fromIntegral @ Integer $ floor created
117118 bins = [0.50 , 0.8 , 0.9 , 0.92 , 0.94 , 0.96 , 0.98 , 1 ]
118119 bin xs = map (\ b -> (,b) $ fst <$> listToMaybe (dropWhile (\ (_, x) -> x < b) xs)) bins
119120
120121data DiffusionLatencyState = DiffusionLatencyState
121122 { chains :: ! ChainsMap
122123 , diffusions :: ! DiffusionLatencyMap
123- , cpuTasks :: ! (Map. Map NodeId [(DiffTime , CPUTask )])
124124 , fetchRequests :: ! (Map. Map NodeId (Map. Map (HeaderHash (Block BlockBody )) [DiffTime ]))
125125 , receivedBodies :: ! (Map. Map NodeId (Map. Map (HeaderHash (Block BlockBody )) [DiffTime ]))
126126 , blocks :: ! (Blocks BlockBody )
@@ -129,12 +129,11 @@ data DiffusionLatencyState = DiffusionLatencyState
129129diffusionSampleModel :: P2PTopography -> FilePath -> SampleModel PraosEvent DiffusionLatencyState
130130diffusionSampleModel p2pTopography fp = SampleModel initState accum render
131131 where
132- initState = DiffusionLatencyState IMap. empty Map. empty Map. empty Map. empty Map. empty Map. empty
132+ initState = DiffusionLatencyState IMap. empty Map. empty Map. empty Map. empty Map. empty
133133 accum t e DiffusionLatencyState {.. } =
134134 DiffusionLatencyState
135135 { chains = accumChains t e chains
136136 , diffusions = accumDiffusionLatency t e diffusions
137- , cpuTasks = accumCPUTasks t e cpuTasks
138137 , fetchRequests = accumFetchRequests blocks t e fetchRequests
139138 , receivedBodies = accumReceived t e receivedBodies
140139 , blocks = accumBlocks e blocks
@@ -187,7 +186,6 @@ diffusionSampleModel p2pTopography fp = SampleModel initState accum render
187186 , entries
188187 , latency_per_stake
189188 , stable_chain_hashes
190- , cpuTasks
191189 , average_latencies
192190 }
193191
@@ -296,11 +294,6 @@ example1000Diffusion rng0 cfg
[email protected] {p2pNodes, p2pNodeStakes}
296294 traceFile = dropExtension fp <.> " log"
297295 blockInterval = 1 / praosConfig. blockFrequencyPerSlot
298296 praosConfig = maybe defaultPraosConfig convertConfig cfg
299- -- PraosConfig
300- -- { headerValidationDelay = const 0.00141 -- benchmark data: noticed to fetch request
301- -- , blockValidationDelay = const 0.04453 -- benchmark data: fetched to sending
302- -- -- , blockValidationDelay = const 0.08589 -- benchmark data: fetched to adopted
303- -- }
304297 p2pNumNodes = Map. size $ p2pNodes
305298 trace =
306299 tracePraosP2P
0 commit comments