Skip to content

Commit

Permalink
locli: earliest fetch metric
Browse files Browse the repository at this point in the history
  • Loading branch information
deepfire committed Mar 4, 2023
1 parent eb3214c commit c897c53
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 18 deletions.
10 changes: 7 additions & 3 deletions bench/locli/src/Cardano/Analysis/API/Metrics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ bpFieldsControl =
bpFieldsForger =
[ "cdfForgerStart", "cdfForgerBlkCtx", "cdfForgerLgrState", "cdfForgerLgrView", "cdfForgerLead", "cdfForgerTicked", "cdfForgerMemSnap", "cdfForgerForge", "cdfForgerAnnounce", "cdfForgerSend", "cdfForgerAdoption", "cdfForgerAnnounceCum" ]
bpFieldsPeers =
[ "cdfPeerNotice", "cdfPeerRequest", "cdfPeerFetch", "cdfPeerAnnounce", "cdfPeerSend", "cdfPeerAdoption" ]
[ "cdfPeerNoticeFirst", "cdfPeerFetchFirst", "cdfPeerRequest", "cdfPeerFetch", "cdfPeerAnnounce", "cdfPeerSend", "cdfPeerAdoption" ]
bpFieldsEndToEnd =
adoptionCentiles <&> FieldName . renderAdoptionCentile
bpFieldsEndToEndBrief =
adoptionCentilesBrief <&> FieldName . renderAdoptionCentile

instance CDFFields BlockProp p where
cdfFields =
fGrp ",------------------- Forger event Δt: ---------------------."
fGrp ",------------------ Forger event Δt: --------------------."
W4 Sec P3 Log Free
[ fGrp' "cdfForgerStart" "Loop" (DDeltaT cdfForgerStart)
"Started forge loop iteration"
Expand Down Expand Up @@ -280,10 +280,14 @@ instance CDFFields BlockProp p where
]
<> fGrp ",------ Peer event Δt: ------."
W4 Sec P3 Log Free
[ fGrp' "cdfPeerNotice" "Noti" (DDeltaT cdfPeerNotice)
[ fGrp' "cdfPeerNoticeFirst" "NtiF" (DDeltaT cdfPeerNoticeFirst)
"First peer notice"
"Time it took for the fastest peer to notice the block (ChainSyncClientEvent.TraceDownloadedHeader), since block's slot start"

, fGrp' "cdfPeerFetchFirst" "FetF" (DDeltaT cdfPeerFetchFirst)
"First peer fetch"
"Time it took for the fastest peer to fetch the block (BlockFetchClient.CompletedBlockFetch), since block's slot start"

, fGrp' "cdfPeerRequest" "Requ" (DDeltaT cdfPeerRequest)
"Notice to fetch request"
"Time it took the peer to request the block body (BlockFetchClient.SendFetchRequest), after it have seen its header"
Expand Down
3 changes: 2 additions & 1 deletion bench/locli/src/Cardano/Analysis/API/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ data BlockProp f
, cdfForgerAdoption :: !(CDF f NominalDiffTime)
, cdfForgerSend :: !(CDF f NominalDiffTime)
, cdfForgerAnnounceCum :: !(CDF f NominalDiffTime)
, cdfPeerNotice :: !(CDF f NominalDiffTime)
, cdfPeerNoticeFirst :: !(CDF f NominalDiffTime)
, cdfPeerFetchFirst :: !(CDF f NominalDiffTime)
, cdfPeerRequest :: !(CDF f NominalDiffTime)
, cdfPeerFetch :: !(CDF f NominalDiffTime)
, cdfPeerAnnounce :: !(CDF f NominalDiffTime)
Expand Down
34 changes: 20 additions & 14 deletions bench/locli/src/Cardano/Analysis/BlockProp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ summariseMultiBlockProp centiles bs@(headline:_) = do
cdfForgerSend <- cdf2OfCDFs comb $ bs <&> cdfForgerSend
cdfForgerAdoption <- cdf2OfCDFs comb $ bs <&> cdfForgerAdoption
cdfForgerAnnounceCum <- cdf2OfCDFs comb $ bs <&> cdfForgerAnnounceCum
cdfPeerNotice <- cdf2OfCDFs comb $ bs <&> cdfPeerNotice
cdfPeerNoticeFirst <- cdf2OfCDFs comb $ bs <&> cdfPeerNoticeFirst
cdfPeerFetchFirst <- cdf2OfCDFs comb $ bs <&> cdfPeerFetchFirst
cdfPeerRequest <- cdf2OfCDFs comb $ bs <&> cdfPeerRequest
cdfPeerFetch <- cdf2OfCDFs comb $ bs <&> cdfPeerFetch
cdfPeerAdoption <- cdf2OfCDFs comb $ bs <&> cdfPeerAdoption
Expand Down Expand Up @@ -436,18 +437,19 @@ rebuildChain run@Run{genesis} flts fltNames xs@(fmap snd -> machViews) =
, beObservations =
catSMaybes $
os <&> \ObserverEvents{..}->
BlockObservation
<$> SJust boeHost
<*> SJust bfeSlotStart
<*> boeNoticed
<*> boeRequested
<*> boeFetched
<*> SJust boeAnnounced
<*> SJust boeSending
<*> SJust boeAdopted
<*> SJust boeChainDelta
<*> SJust boeErrorsCrit
<*> SJust boeErrorsSoft
do
let boObserver = boeHost
boSlotStart = bfeSlotStart
boAnnounced = boeAnnounced
boSending = boeSending
boAdopted = boeAdopted
boChainDelta = boeChainDelta
boErrorsCrit = boeErrorsCrit
boErrorsSoft = boeErrorsSoft
boNoticed <- boeNoticed
boRequested <- boeRequested
boFetched <- boeFetched
pure BlockObservation{..}
, bePropagation = cdf adoptionCentiles adoptions
, beOtherBlocks = otherBlocks <&>
\(ForgerEvents{bfeBlock}, _) -> bfeBlock
Expand Down Expand Up @@ -509,7 +511,8 @@ blockProp run@Run{genesis} Chain{..} = do
, cdfForgerAnnounceCum = forgerCDF (SJust . bfAnnouncedCum . beForge)
, cdfForgerSend = forgerCDF (SJust . bfSending . beForge)
, cdfForgerAdoption = forgerCDF (SJust . bfAdopted . beForge)
, cdfPeerNotice = observerCDF (SJust . boNoticed) earliest "noticed"
, cdfPeerNoticeFirst = observerCDF (SJust . boNoticed) earliest "noticed"
, cdfPeerFetchFirst = observerCDF (SJust . boFetchedCum) earliest "fetched"
, cdfPeerRequest = observerCDF (SJust . boRequested) each "requested"
, cdfPeerFetch = observerCDF (SJust . boFetched) each "fetched"
, cdfPeerAnnounce = observerCDF boAnnounced each "announced"
Expand Down Expand Up @@ -538,6 +541,9 @@ blockProp run@Run{genesis} Chain{..} = do
where
hostBlockStats = Map.elems cHostBlockStats

boFetchedCum :: BlockObservation -> NominalDiffTime
boFetchedCum BlockObservation{..} = boNoticed + boRequested + boFetched

analysisChain :: [BlockEvents]
analysisChain = filter (all snd . beAcceptance) cMainChain

Expand Down

0 comments on commit c897c53

Please sign in to comment.