Skip to content

Commit

Permalink
bench | locli: print DataDomain in MachineTimeline
Browse files Browse the repository at this point in the history
  • Loading branch information
deepfire committed Jan 17, 2022
1 parent 7625520 commit 9a475cd
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
10 changes: 10 additions & 0 deletions bench/locli/src/Cardano/Analysis/API.hs
Expand Up @@ -128,6 +128,16 @@ data BPErrorKind
| BPEFork !Hash
deriving (FromJSON, Generic, NFData, Show, ToJSON)

data DataDomain
= DataDomain
{ ddRawSlotFirst :: SlotNo
, ddRawSlotLast :: SlotNo
, ddAnalysisSlotFirst :: SlotNo
, ddAnalysisSlotLast :: SlotNo
}
deriving (Generic, Show, ToJSON)
-- Perhaps: Plutus.V1.Ledger.Slot.SlotRange = Interval Slot

--
-- * Key properties
--
Expand Down
9 changes: 9 additions & 0 deletions bench/locli/src/Cardano/Analysis/Driver.hs
Expand Up @@ -205,6 +205,15 @@ runMachineTimeline chainInfo logfiles chFilters MachineTimelineOutputFiles{..} =
-- 2. Reprocess the slot stats
let slotStats = filterSlotStats chFilters noisySlotStats

let rawSlotFirst = (head noisySlotStats <&> slSlot) & fromMaybe 0
rawSlotLast = (lastMay noisySlotStats <&> slSlot) & fromMaybe 0
anaSlotFirst = (head slotStats <&> slSlot) & fromMaybe 0
anaSlotLast = (lastMay slotStats <&> slSlot) & fromMaybe 0
liftIO . LBS.putStrLn . AE.encode $
DataDomain
rawSlotFirst rawSlotLast
anaSlotFirst anaSlotLast

-- 3. Derive the timeline
let drvVectors0, _drvVectors1 :: [DerivedSlot]
(,) drvVectors0 _drvVectors1 = computeDerivedVectors slotStats
Expand Down
8 changes: 4 additions & 4 deletions nix/workbench/analyse.sh
Expand Up @@ -43,8 +43,10 @@ case "$op" in
time locli 'analyse' 'chaininfo' "${locli_args[@]}"
;;
standard | std )
analyse ${self_args[*]} block-propagation "$@"
analyse ${self_args[*]} --reanalyse machine-timeline "$@"
for r in $*
do analyse ${self_args[*]} block-propagation $r
analyse ${self_args[*]} --reanalyse machine-timeline $r
done
;;
block-propagation | bp )
local usage="USAGE: wb analyse $op [RUN-NAME=current].."
Expand Down Expand Up @@ -90,8 +92,6 @@ case "$op" in
msg "analysis block-propagation: All done."
fi

msg "log sizes: (files: $(ls "$adir"/*.flt.json 2>/dev/null | wc -l), lines: $(cat "$adir"/*.flt.json | wc -l))"

msg "analysing.."
locli_args+=(
--genesis "$dir"/genesis-shelley.json
Expand Down
5 changes: 3 additions & 2 deletions nix/workbench/run.sh
Expand Up @@ -99,6 +99,7 @@ case "$op" in
}
'
fi;;

fix-systemstart )
local usage="USAGE: wb run $op TAG [MACH=node-1]"
local tag=${1:?$usage}
Expand All @@ -118,12 +119,12 @@ case "$op" in
local genesis_systemStart=$(jq .systemStart $genesis -r)

if test "$genesis_systemStart" != "$apparent_systemStart"
then msg "systemStart mismatch in $tag: $apparent_systemStart (log), $genesis_systemStart (genesis) -- fixing genesis to the former"
then msg "Fixing genesis systemStart in $tag: $apparent_systemStart (log), $genesis_systemStart (genesis)"
jq_fmutate "$dir"/genesis-shelley.json '. *
{ systemStart: $systemStart
}
' --arg systemStart $apparent_systemStart
else msg "systemStart check passed: both at $genesis_systemStart"
else msg "Good: both genesis and log-implied systemStart are at: $genesis_systemStart"
fi;;

get-path | get )
Expand Down

0 comments on commit 9a475cd

Please sign in to comment.