Skip to content

Commit 6034f96

Browse files
committed
locli: report improvements: autogen list, pass through workload & tag charts with runs
1 parent bf311b9 commit 6034f96

File tree

7 files changed

+74
-60
lines changed

7 files changed

+74
-60
lines changed

bench/locli/src/Cardano/Analysis/API.hs

+32-32
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,11 @@ data PropSubset
340340

341341
bpFieldSelectForger :: Field DSelect p a -> Bool
342342
bpFieldSelectForger Field{fId} = elem fId
343-
[ "fStarted", "fLeading", "fForged", "fAnnounced", "fAdopted", "fSendStart" ]
343+
[ "bfStarted", "bfLeading", "bfForged", "bfAnnounced", "fSending", "bfAdopted" ]
344344

345345
bpFieldSelectPeers :: Field DSelect p a -> Bool
346346
bpFieldSelectPeers Field{fId} = elem fId
347-
[ "pNoticed", "pRequested", "pFetched", "pAnnounced", "pAdopted", "pSendStart" ]
347+
[ "boNoticed", "boRequested", "boFetched", "boAnnounced", "boSending", "boAdopted" ]
348348

349349
bpFieldSelectEndToEnd :: Field DSelect p a -> Bool
350350
bpFieldSelectEndToEnd Field{fHead2} = elem fHead2 adoptionCentilesRendered
@@ -449,37 +449,37 @@ instance CDFFields BlockProp p where
449449
instance TimelineFields BlockEvents where
450450
timelineFields _ =
451451
-- Width LeftPad
452-
[ Field 5 0 "block" "block" "no." (IWord64 (unBlockNo . beBlockNo)) ""
453-
, Field 5 0 "abs.slot" "abs." "slot#" (IWord64 (unSlotNo . beSlotNo)) ""
454-
, Field 6 0 "hash" "block" "hash" (IText (shortHash . beBlock)) ""
455-
, Field 6 0 "hashPrev" "prev" "hash" (IText (shortHash . beBlockPrev)) ""
456-
, Field 7 0 "forger" "forger" "host" (IText (toText . unHost . bfForger . beForge)) ""
457-
, Field 6 0 "blockSize" "size" "bytes" (IInt (bfBlockSize . beForge)) ""
458-
, Field 5 0 "blockGap" "block" "gap" (IDeltaT (bfBlockGap . beForge)) ""
459-
, Field 3 0 "forks" "for" "-ks" (IInt (count bpeIsFork . beErrors)) ""
460-
, Field 4 0 "fStarted" (f!!0) "Start" (IDeltaT (bfStarted . beForge)) ""
461-
, Field 4 0 "fBlkCtx" (f!!1) "BlkCtx" (IText (maybe "?" show.bfBlkCtx .beForge)) ""
462-
, Field 4 0 "fLgrState" (f!!2) "LgrSta" (IText (maybe "?" show.bfLgrState.beForge)) ""
463-
, Field 4 0 "fLgrView" (f!!3) "LgrVie" (IText (maybe "?" show.bfLgrView .beForge)) ""
464-
, Field 4 0 "fLeading" (f!!4) "Lead" (IDeltaT (bfLeading . beForge)) ""
465-
, Field 4 0 "fForged" (f!!5) "Forge" (IDeltaT (bfForged . beForge)) ""
466-
, Field 4 0 "fAnnounced" (f!!6) "Announ" (IDeltaT (bfAnnounced . beForge)) ""
467-
, Field 4 0 "fSendStart" (f!!7) "Sendin" (IDeltaT (bfSending . beForge)) ""
468-
, Field 4 0 "fAdopted" (f!!8) "Adopt" (IDeltaT (bfAdopted . beForge)) ""
469-
, Field 4 0 "noticedVal" (p!!0) "Notic" (IDeltaT (af boNoticed . valids)) ""
470-
, Field 4 0 "requestedVal" (p!!1) "Requd" (IDeltaT (af boRequested . valids)) ""
471-
, Field 4 0 "fetchedVal" (p!!2) "Fetch" (IDeltaT (af boFetched . valids)) ""
472-
, Field 4 0 "pAnnouncedVal" (p!!3) "Annou" (IDeltaT (af' boAnnounced . valids)) ""
473-
, Field 4 0 "pSendStartVal" (p!!4) "Send" (IDeltaT (af' boSending . valids)) ""
474-
, Field 4 0 "pAdoptedVal" (p!!5) "Adopt" (IDeltaT (af' boAdopted . valids)) ""
475-
, Field 4 0 "pPropag0.5" (r!!0) "0.5" (IDeltaT (percSpec 0.5 . bePropagation)) ""
476-
, Field 4 0 "pPropag0.8" (r!!1) "0.8" (IDeltaT (percSpec 0.8 . bePropagation)) ""
477-
, Field 4 0 "pPropag0.96" (r!!2) "0.96" (IDeltaT (percSpec 0.96 . bePropagation)) ""
478-
, Field 4 0 "pPropag1.0" (r!!3) "1.0" (IDeltaT (snd . cdfRange . bePropagation)) ""
479-
, Field 3 0 "valid" "va-" "lid" (IText (bool "-" "+" . (== 0) . length
452+
[ Field 5 0 "beBlockNo" "block" "no." (IWord64 (unBlockNo . beBlockNo)) ""
453+
, Field 5 0 "beSlotNo" "abs." "slot#" (IWord64 (unSlotNo . beSlotNo)) ""
454+
, Field 6 0 "beBlock" "block" "hash" (IText (shortHash . beBlock)) ""
455+
, Field 6 0 "beBlockPrev" "prev" "hash" (IText (shortHash . beBlockPrev)) ""
456+
, Field 7 0 "bfForger" "forger" "host" (IText (toText . unHost . bfForger . beForge)) ""
457+
, Field 6 0 "bfBlockSize" "size" "bytes" (IInt (bfBlockSize . beForge)) ""
458+
, Field 5 0 "bfBlockGap" "block" "gap" (IDeltaT (bfBlockGap . beForge)) ""
459+
, Field 3 0 "bpeIsFork" "for" "-ks" (IInt (count bpeIsFork . beErrors)) ""
460+
, Field 4 0 "bfStarted" (f!!0) "Start" (IDeltaT (bfStarted . beForge)) ""
461+
, Field 4 0 "bfBlkCtx" (f!!1) "BlkCtx" (IText (maybe "?" show.bfBlkCtx .beForge)) ""
462+
, Field 4 0 "bfLgrState" (f!!2) "LgrSta" (IText (maybe "?" show.bfLgrState.beForge)) ""
463+
, Field 4 0 "bfLgrView" (f!!3) "LgrVie" (IText (maybe "?" show.bfLgrView .beForge)) ""
464+
, Field 4 0 "bfLeading" (f!!4) "Lead" (IDeltaT (bfLeading . beForge)) ""
465+
, Field 4 0 "bfForged" (f!!5) "Forge" (IDeltaT (bfForged . beForge)) ""
466+
, Field 4 0 "bfAnnounced" (f!!6) "Announ" (IDeltaT (bfAnnounced . beForge)) ""
467+
, Field 4 0 "bfSending" (f!!7) "Sendin" (IDeltaT (bfSending . beForge)) ""
468+
, Field 4 0 "bfAdopted" (f!!8) "Adopt" (IDeltaT (bfAdopted . beForge)) ""
469+
, Field 4 0 "boNoticed" (p!!0) "Notic" (IDeltaT (af boNoticed . valids)) ""
470+
, Field 4 0 "boRequested" (p!!1) "Requd" (IDeltaT (af boRequested . valids)) ""
471+
, Field 4 0 "boFetched" (p!!2) "Fetch" (IDeltaT (af boFetched . valids)) ""
472+
, Field 4 0 "boAnnounced" (p!!3) "Annou" (IDeltaT (af' boAnnounced . valids)) ""
473+
, Field 4 0 "boSending" (p!!4) "Send" (IDeltaT (af' boSending . valids)) ""
474+
, Field 4 0 "pAdopted" (p!!5) "Adopt" (IDeltaT (af' boAdopted . valids)) ""
475+
, Field 4 0 "bePropagation.5" (r!!0) "0.5" (IDeltaT (percSpec 0.5 . bePropagation)) ""
476+
, Field 4 0 "bePropagation.8" (r!!1) "0.8" (IDeltaT (percSpec 0.8 . bePropagation)) ""
477+
, Field 4 0 "bePropagation.96"(r!!2) "0.96" (IDeltaT (percSpec 0.96 . bePropagation)) ""
478+
, Field 4 0 "bePropagation.1" (r!!3) "1.0" (IDeltaT (snd . cdfRange . bePropagation)) ""
479+
, Field 3 0 "beAcceptance" "va-" "lid" (IText (bool "-" "+" . (== 0) . length
480480
. filter (not . snd) . beAcceptance)) ""
481481
, Field 3 0 "valid.observ" "good" "obsv" (IInt (length . valids)) ""
482-
, Field 5 0 "errors" "all" "errs" (IInt (length . beErrors)) ""
482+
, Field 5 0 "beErrors" "all" "errs" (IInt (length . beErrors)) ""
483483
, Field 3 0 "missNotic" (m!!0) "ntc" (IInt (count (bpeIsMissing Notice) . beErrors)) ""
484484
, Field 3 0 "missReque" (m!!1) "req" (IInt (count (bpeIsMissing Request) . beErrors)) ""
485485
, Field 3 0 "missFetch" (m!!2) "fch" (IInt (count (bpeIsMissing Fetch) . beErrors)) ""
@@ -538,7 +538,7 @@ data PerfSubset
538538

539539
mtFieldsReport :: Field DSelect p a -> Bool
540540
mtFieldsReport Field{fId} = elem fId
541-
[ "cpuProcess", "cpuGC", "cpuMutator", "cpuSpanLenAll", "memRSS", "rtsHeap", "rtsLive", "rtsAllocation" ]
541+
[ "rCentiCpu", "rCentiGC", "rCentiMut", "cdfSpanLensCpu", "rRSS", "rHeap", "rLive", "rAlloc" ]
542542

543543
perfSubsetFn :: PerfSubset -> (Field DSelect p a -> Bool)
544544
perfSubsetFn = \case

bench/locli/src/Cardano/Analysis/Context.hs

+7-5
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ data PParams
4646

4747
data GeneratorProfile
4848
= GeneratorProfile
49-
{ add_tx_size :: Word64
50-
, inputs_per_tx :: Word64
51-
, outputs_per_tx :: Word64
52-
, tps :: Double
53-
, tx_count :: Word64
49+
{ add_tx_size :: Word64
50+
, inputs_per_tx :: Word64
51+
, outputs_per_tx :: Word64
52+
, tps :: Double
53+
, tx_count :: Word64
54+
, plutusMode :: Maybe Bool
55+
, plutusLoopScript :: Maybe FilePath
5456
}
5557
deriving (Generic, Show, FromJSON, ToJSON)
5658

bench/locli/src/Cardano/Report.hs

+24-12
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ import Data.List (last)
1616
import Data.Text qualified as T
1717
import Data.Text.Lazy qualified as LT
1818
import Data.Time.Clock
19+
import System.FilePath as FS
1920
import System.Posix.User
2021

21-
import Text.EDE
22+
import Text.EDE hiding (Id)
2223

2324
import Data.CDF
2425

@@ -61,18 +62,20 @@ getReport rTarget mrev = do
6162

6263
data Workload
6364
= WValue
64-
| WPlutus
65+
| WPlutusLoopCountdown
66+
| WPlutusLoopSECP
6567

6668
instance ToJSON Workload where
6769
toJSON = \case
68-
WValue -> "Value"
69-
WPlutus -> "Plutus"
70+
WValue -> "value-only"
71+
WPlutusLoopCountdown -> "Plutus countdown loop"
72+
WPlutusLoopSECP -> "Plutus SECP loop"
7073

7174
data Section where
7275
STable :: CDFFields a p =>
7376
{ sData :: !(a p)
7477
, sFieldSelector :: !(Field DSelect p a -> Bool)
75-
, sDataId :: !Text
78+
, sDataRef :: !Text
7679
, sOrgTableSrc :: !Text
7780
, sTitle :: !Text
7881
} -> Section
@@ -107,7 +110,7 @@ instance ToJSON TmplRun where
107110
toJSON TmplRun{trManifest=Manifest{..},..} =
108111
object
109112
[ "meta" .= trMeta
110-
, "id" .= trShortId
113+
, "shortId" .= trShortId
111114
, "workload" .= trWorkload
112115
, "branch" .= mNodeBranch
113116
, "ver" .= mNodeApproxVer
@@ -124,26 +127,33 @@ instance ToJSON TmplRun where
124127
]
125128

126129
liftTmplRun :: Run -> TmplRun
127-
liftTmplRun Run{..} =
130+
liftTmplRun Run{generatorProfile=GeneratorProfile{..}, ..} =
128131
TmplRun
129132
{ trMeta = metadata
130133
, trShortId = ShortId (batch metadata)
131-
, trWorkload = WValue
132134
, trManifest = manifest metadata & unsafeShortenManifest 5
135+
, trWorkload =
136+
case ( plutusMode & fromMaybe False
137+
, plutusLoopScript & fromMaybe "" & FS.takeFileName & FS.dropExtension ) of
138+
(False, _) -> WValue
139+
(True, "loop") -> WPlutusLoopCountdown
140+
(True, "schnorr-secp256k1-loop") -> WPlutusLoopSECP
141+
(_, scr) ->
142+
error $ "Unknown Plutus script: " <> scr
133143
}
134144

135145
data TmplSection
136146
= TmplTable
137147
{ tsTitle :: !Text
138-
, tsDataId :: !Text
148+
, tsDataRef :: !Text
139149
, tsOrgTableSrc :: !Text
140150
, tsNRows :: !Int
141151
}
142152

143153
instance ToJSON TmplSection where
144154
toJSON TmplTable{..} = object
145155
[ "title" .= tsTitle
146-
, "dataId" .= tsDataId
156+
, "dataRef" .= tsDataRef
147157
, "orgFile" .= tsOrgTableSrc
148158
-- Yes, strange as it is, this is the encoding to ease iteration in ED-E.
149159
, "rows" .= T.replicate tsNRows "."
@@ -155,9 +165,11 @@ liftTmplSection =
155165
STable{..} ->
156166
TmplTable
157167
{ tsTitle = sTitle
158-
, tsDataId = sDataId
168+
, tsDataRef = sDataRef
159169
, tsOrgTableSrc = sOrgTableSrc
160-
, tsNRows = length $ filterFields sFieldSelector
170+
, tsNRows =
171+
-- trace (printf "nrows: %d" $ length $ filterFields sFieldSelector :: String) $
172+
length $ filterFields sFieldSelector
161173
}
162174

163175
generate :: InputDir -> Maybe TextInputFile

nix/workbench/ede/chart.ede

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ set yrange [*:*]
1414
set ylabel "{{ args.ylabel }}"
1515
{% endif %}
1616
eval cdfI_{{ (runs | length) + 1 }}("{{ args.metric }}", "{{ args.title }}", \
17-
"{{ base.ver }}/{{ base.meta.era | toTitle }}", "{{ base.meta.tag }}", \
17+
"{{ base.meta.tag }}/{{ base.shortId }}/{{ base.meta.era | toTitle }}", "{{ base.meta.tag }}", \
1818
{% for run in runs %}
19-
"{{ run.value.ver }}/{{ run.value.meta.era | toTitle }}", "{{ run.value.meta.tag }}"{% if !run.last %},{% endif %} \
19+
"{{ run.value.meta.tag }}/{{ run.value.shortId }}/{{ run.value.meta.era | toTitle }}", "{{ run.value.meta.tag }}"{% if !run.last %},{% endif %} \
2020
{% endfor %}
2121
)
2222
#+end_src

nix/workbench/ede/report.ede

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#+CONSTANTS:{% for sec in sections %} {{ sec.value.dataId }}={{ sec.value.orgFile }} {% endfor %}
1+
#+CONSTANTS:{% for sec in sections %} {{ sec.value.dataRef }}={{ sec.value.orgFile }} {% endfor %}
22
#+CONSTANTS: base=../{{ base.meta.tag }}/analysis
33
{% for run in runs %}
44
#+CONSTANTS: run{{ run.index }}=../{{ run.value.meta.tag }}/analysis
@@ -18,7 +18,7 @@
1818

1919
*** Manifest
2020

21-
We compare ... relative to ={{ base.ver }}= /{{ base.meta.era | toTitle }}, under {{ base.workload }} workload.
21+
We compare {% for run in runs %}{%if !run.first%}{%if !run.last%}, {%else%} and {%endif%}{%endif%}{{ run.value.ver }}/{{ run.value.meta.era | toTitle }}{% endfor %} relative to ={{ base.ver }}=/{{ base.meta.era | toTitle }}, under {{ base.workload }} workload.
2222

2323
{% include "manifest.ede" %}
2424

nix/workbench/ede/table.ede

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
| | {% for run in runs %} | | | {% endfor %} |
55
{% endfor %}
66
|---------------------------+-----{% for run in runs %}-+------+------+-----{% endfor %}-|
7-
#+TBLFM: $2=remote(file:$base/${{ table.dataId }},@@#$average);p3::$1=remote(file:$base/${{ table.dataId }},@@#$metric)
7+
#+TBLFM: $2=remote(file:$base/${{ table.dataRef }},@@#$average);p3::$1=remote(file:$base/${{ table.dataRef }},@@#$metric)
88
{% for run in runs %}
9-
#+TBLFM: ${{ run.index * 3 }}=remote(file:$run{{ run.index }}/${{ table.dataId }},@@#$average);p3::${{ run.index * 3 + 1 }}=${{ run.index * 3 }}-$2;p3::${{ run.index * 3 + 2 }}=round(100*${{ run.index * 3 + 1 }}/$2)
9+
#+TBLFM: ${{ run.index * 3 }}=remote(file:$run{{ run.index }}/${{ table.dataRef }},@@#$average);p3::${{ run.index * 3 + 1 }}=${{ run.index * 3 }}-$2;p3::${{ run.index * 3 + 2 }}=round(100*${{ run.index * 3 + 1 }}/$2)
1010
{% endfor %}

nix/workbench/run.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ usage_run() {
2020
2121
$(helpcmd list-aws) List AWS runs
2222
$(blk lsaws)
23-
$(helpcmd fetch-aws RUN)
23+
$(helpcmd fetch-run RUN)
2424
Fetch an AWS run
25-
$(blk fetch)
26-
$(helpcmd analysis-from-aws RUN..)
27-
$(blk fetch-analysis fa) Fetch analyses of AWS runs
25+
$(blk fetch fr)
26+
$(helpcmd fetch-analysis RUN..)
27+
$(blk fa) Fetch analyses of AWS runs
2828
$(helpcmd analyse-aws RUN..) Run analyses of AWS runs, remotely
2929
3030
$(helpcmd describe RUN)
@@ -524,7 +524,7 @@ case "$op" in
524524

525525
echo $dir;;
526526

527-
fetch-run | fr )
527+
fetch-run | fetch | fr )
528528
local usage="USAGE: wb run $op RUN [MACHINE] [DEPLOYMENT=bench-1] [ENV=bench]"
529529
local run=${1:?$usage}
530530
local mach=${2:-all-hosts}

0 commit comments

Comments
 (0)