Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaste committed Dec 1, 2023
1 parent f269aea commit 9c7d94c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions bench/cardano-topology/src/Cardano/Benchmarking/Topology.hs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ data Spec = Spec
idName :: Int -> String
idName = ("node-" <>) . show

-- | Create a node from Spec adding the default values.
mkNode :: Spec -> Types.Node
mkNode Spec{..} = Types.Node{..} where
name = idName nodeId
Expand All @@ -101,8 +102,8 @@ mkNode Spec{..} = Types.Node{..} where

mkCoreNodes' :: CoreNodesParams -> [Spec]
mkCoreNodes' Line{..} = breakLoop tpSize phase1 where
specIds = [0..(tpSize - 1)]
-- Assign locations and pool counts; set initial links.
specIds = [0..(tpSize - 1)] -- Nodes ids starting from zero.
-- Assign pool counts, empty list of links and the only locations.
phase0 = mkInitial <$> specIds
where
mkInitial :: Int -> Spec
Expand All @@ -116,8 +117,8 @@ mkCoreNodes' Line{..} = breakLoop tpSize phase1 where
-- Connect into a ring
phase1 = intraConnectRing False True phase0
mkCoreNodes' UniCircle{..} = phase1 where
specIds = [0..(tpSize - 1)]
-- Assign locations and pool counts; set initial links.
specIds = [0..(tpSize - 1)] -- Nodes ids starting from zero.
-- Assign pool counts, empty list of links and the only locations.
phase0 = mkInitial <$> specIds
where
mkInitial :: Int -> Spec
Expand All @@ -131,9 +132,10 @@ mkCoreNodes' UniCircle{..} = phase1 where
-- Connect into a ring
phase1 = intraConnectRing False False phase0
mkCoreNodes' Torus{..} = concat phase3 where
specIds = [0..(tpSize - 1)]
specIds = [0..(tpSize - 1)] -- Nodes ids starting from zero.
-- A list of repating locations (in the same order).
specLocs = take tpSize $ cycle tpLocations
-- Assign locations and pool counts; set initial links.
-- Assign pool counts, empty list of links and the locations in order.
phase0 = zipWith mkInitial specIds specLocs
where
mkInitial :: Int -> Types.Location -> Spec
Expand All @@ -143,7 +145,7 @@ mkCoreNodes' Torus{..} = concat phase3 where
, mpools = tpIdPools id
, ..
}
-- Split into per-location lists.
-- Split into per-location lists (list of lists).
phase1 =
[
filter ((== l) . loc) phase0
Expand Down

0 comments on commit 9c7d94c

Please sign in to comment.