Skip to content

Commit 79f3272

Browse files
committed
workbench: implement selective perfanalysis omission
1 parent 11a3a07 commit 79f3272

File tree

2 files changed

+35
-24
lines changed

2 files changed

+35
-24
lines changed

bench/locli/src/Cardano/Command.hs

+10-5
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ parseChainCommand =
105105

106106
subparser (mconcat [ commandGroup "Machine performance analysis: slot stats"
107107
, op "collect-slots" "Collect per-slot performance stats"
108-
(CollectSlots & pure)
108+
(CollectSlots
109+
<$> many
110+
(optJsonLogfile "ignore-log" "Omit data from listed log files from perf statistics"))
109111
, op "dump-slots-raw" "Dump unfiltered slot stats JSON streams, alongside input files"
110112
(DumpSlotsRaw & pure)
111113
, op "filter-slots" "Filter per-slot performance stats"
@@ -223,7 +225,7 @@ data ChainCommand
223225
| DumpChain JsonOutputFile
224226
| TimelineChain TextOutputFile
225227

226-
| CollectSlots
228+
| CollectSlots [JsonLogfile]
227229
| DumpSlotsRaw
228230
| FilterSlots [JsonFilterFile]
229231
| DumpSlots
@@ -395,13 +397,16 @@ runChainCommand _ c@TimelineChain{} = missingCommandData c
395397
["run metadata & genesis", "filtered chain"]
396398

397399
runChainCommand s@State{sRun=Just run, sObjLists=Just objs}
398-
c@CollectSlots = do
400+
c@(CollectSlots ignores) = do
401+
let nonIgnored = flip filter objs $ (`notElem` ignores) . fst
402+
forM_ ignores $
403+
progress "perf-ignored-log" . R . unJsonLogfile
399404
(scalars, slotsRaw) <-
400-
fmap (mapAndUnzip redistribute) <$> collectSlotStats run objs
405+
fmap (mapAndUnzip redistribute) <$> collectSlotStats run nonIgnored
401406
& newExceptT
402407
& firstExceptT (CommandError c)
403408
pure s { sScalars = Just scalars, sSlotsRaw = Just slotsRaw }
404-
runChainCommand _ c@CollectSlots = missingCommandData c
409+
runChainCommand _ c@CollectSlots{} = missingCommandData c
405410
["run metadata & genesis", "lifted logobjects"]
406411

407412
runChainCommand s@State{sSlotsRaw=Just slotsRaw}

nix/workbench/analyse.sh

+25-19
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ EOF
2727
}
2828

2929
analyse() {
30-
local filters=() aws= sargs=() unfiltered=
30+
local filters=() aws= sargs=() unfiltered= perf_omit_hosts=()
3131
local dump_logobjects= dump_machviews= dump_chain_raw= dump_chain= dump_slots_raw= dump_slots=
3232
while test $# -gt 0
3333
do case "$1" in
@@ -37,6 +37,7 @@ do case "$1" in
3737
--dump-chain | -c ) sargs+=($1); dump_chain='true';;
3838
--dump-slots-raw | -sr ) sargs+=($1); dump_slots_raw='true';;
3939
--dump-slots | -s ) sargs+=($1); dump_slots='true';;
40+
--perf-omit-host ) sargs+=($1 $2); perf_omit_hosts+=($2); shift;;
4041
--filters ) sargs+=($1 $2); analysis_set_filters "base,$2"; shift;;
4142
--no-filters | --unfiltered | -u )
4243
sargs+=($1); analysis_set_filters ""; unfiltered='true';;
@@ -213,9 +214,13 @@ case "$op" in
213214
local adir=$dir/analysis
214215
test -n "$dir" -a -d "$adir" || fail "malformed run: $name"
215216

216-
local logfiles=($(if test -z "$host"
217-
then ls "$adir"/logs-*.flt.json
218-
else ls "$adir"/logs-$host.flt.json; fi))
217+
local logfiles=(
218+
$(if test -z "$host"
219+
then ls "$adir"/logs-*.flt.json
220+
else ls "$adir"/logs-$host.flt.json; fi))
221+
local minus_logfiles=(
222+
$(for host in ${perf_omit_hosts[*]}
223+
do ls "$adir"/logs-$host.flt.json; done))
219224

220225
if test -z "${filters[*]}" -a -z "$unfiltered"
221226
then local filter_names=$(jq '.analysis.filters
@@ -231,23 +236,24 @@ case "$op" in
231236
--shelley-genesis "$dir"/genesis-shelley.json })
232237
v3=(${v2[*]/#dump-chain-raw/ 'dump-chain-raw' --chain "$adir"/chain-raw.json})
233238
v4=(${v3[*]/#chain-timeline-raw/ 'timeline-chain-raw' --timeline "$adir"/chain-raw.txt})
234-
v5=(${v4[*]/#filter-chain/ 'filter-chain' ${filters[*]}})
239+
v5=(${v4[*]/#filter-chain/ 'filter-chain' ${filters[*]}})
235240
v6=(${v5[*]/#dump-chain/ 'dump-chain' --chain "$adir"/chain.json})
236241
v7=(${v6[*]/#chain-timeline/ 'timeline-chain' --timeline "$adir"/chain.txt})
237-
v8=(${v7[*]/#filter-slots/ 'filter-slots' ${filters[*]}})
238-
v9=(${v8[*]/#propagation-json/ 'render-propagation' --json "$adir"/blockprop.json --full})
239-
va=(${v9[*]/#propagation-org/ 'render-propagation' --org "$adir"/blockprop.org --full})
240-
vb=(${va[*]/#propagation-forger/ 'render-propagation' --report "$adir"/blockprop.forger.org --forger})
241-
vc=(${vb[*]/#propagation-peers/ 'render-propagation' --report "$adir"/blockprop.peers.org --peers })
242-
vd=(${vc[*]/#propagation-endtoend/ 'render-propagation' --report "$adir"/blockprop.endtoend.org --end-to-end})
243-
ve=(${vd[*]/#propagation-gnuplot/ 'render-propagation' --gnuplot "$adir"/%s.cdf --full})
244-
vf=(${ve[*]/#propagation-full/ 'render-propagation' --pretty "$adir"/blockprop-full.txt --full})
245-
vg=(${vf[*]/#clusterperf-json/ 'render-clusterperf' --json "$adir"/clusterperf.json --full })
246-
vh=(${vg[*]/#clusterperf-org/ 'render-clusterperf' --org "$adir"/clusterperf.org --full })
247-
vi=(${vh[*]/#clusterperf-report/ 'render-clusterperf' --report "$adir"/clusterperf.report.org --summary })
248-
vj=(${vi[*]/#clusterperf-gnuplot/ 'render-clusterperf' --gnuplot "$adir"/%s.cdf --full })
249-
vk=(${vj[*]/#clusterperf-full/ 'render-clusterperf' --pretty "$adir"/clusterperf-full.txt --full })
250-
local ops_final=(${vk[*]})
242+
v8=(${v7[*]/#collect-slots/ 'collect-slots' ${minus_logfiles[*]/#/--ignore-log }})
243+
v9=(${v8[*]/#filter-slots/ 'filter-slots' ${filters[*]}})
244+
va=(${v9[*]/#propagation-json/ 'render-propagation' --json "$adir"/blockprop.json --full})
245+
vb=(${va[*]/#propagation-org/ 'render-propagation' --org "$adir"/blockprop.org --full})
246+
vc=(${vb[*]/#propagation-forger/ 'render-propagation' --report "$adir"/blockprop.forger.org --forger})
247+
vd=(${vc[*]/#propagation-peers/ 'render-propagation' --report "$adir"/blockprop.peers.org --peers })
248+
ve=(${vd[*]/#propagation-endtoend/ 'render-propagation' --report "$adir"/blockprop.endtoend.org --end-to-end})
249+
vf=(${ve[*]/#propagation-gnuplot/ 'render-propagation' --gnuplot "$adir"/%s.cdf --full})
250+
vg=(${vf[*]/#propagation-full/ 'render-propagation' --pretty "$adir"/blockprop-full.txt --full})
251+
vh=(${vg[*]/#clusterperf-json/ 'render-clusterperf' --json "$adir"/clusterperf.json --full })
252+
vi=(${vh[*]/#clusterperf-org/ 'render-clusterperf' --org "$adir"/clusterperf.org --full })
253+
vj=(${vi[*]/#clusterperf-report/ 'render-clusterperf' --report "$adir"/clusterperf.report.org --summary })
254+
vk=(${vj[*]/#clusterperf-gnuplot/ 'render-clusterperf' --gnuplot "$adir"/%s.cdf --full })
255+
vl=(${vk[*]/#clusterperf-full/ 'render-clusterperf' --pretty "$adir"/clusterperf-full.txt --full })
256+
local ops_final=(${vl[*]})
251257

252258
progress "analysis | locli" "$(with_color reset ${locli_rts_args[@]}) $(colorise "${ops_final[@]}")"
253259
time locli "${locli_rts_args[@]}" "${ops_final[@]}"

0 commit comments

Comments
 (0)