-
Notifications
You must be signed in to change notification settings - Fork 7
/
perf_to_stats_csv.jq
executable file
·34 lines (33 loc) · 1.4 KB
/
perf_to_stats_csv.jq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env -S jq -Mf -s -r
[
.[] |
select(has("stats")) |
.stats |
{
sdkRevision: (.metadata.testData.sdkRevision // "" | tostring),
sdkCommitTime: (.metadata.testData.sdkCommitTime | strftime("%Y-%m-%d %H:%M:%S")? // ""),
success: (.duration != null),
chainBootstrapDuration: (.chainBootstrapDuration // .stages["0"].chainInitDuration),
walletDeployDuration: .walletDeployDuration,
loadgenDeployDuration: .loadgenDeployDuration,
cycleSuccessRate: .cyclesSummary.cycleSuccessRate,
cycleAvgDuration: .cyclesSummary.avgDuration,
} + (.stages | with_entries(
.value.stageConfig as $stageConfig |
("stage" + .key + "_") as $stagePrefix |
if ($stageConfig["chainOnly"] != true and $stageConfig["durationConfig"] != 0) then
{ key: ($stagePrefix + "cycleSuccessRate"), value: .value.cyclesSummaries.all.cycleSuccessRate },
{ key: ($stagePrefix + "cycleAvgDuration"), value: .value.cyclesSummaries.all.avgDuration },
{ key: ($stagePrefix + "avgSwingsetBlockTime"), value: .value.blocksSummaries.onlyLive.avgSwingsetTime },
{ key: ($stagePrefix + "avgSwingsetPercentage"), value: .value.blocksSummaries.onlyLive.avgSwingsetPercentage },
empty
else empty end
))
] |
sort_by(.sdkCommitTime) |
(
map(keys_unsorted) | add |
map({key: ., value: true}) | from_entries | keys_unsorted
) as $cols |
$cols, map(. as $row | $cols | map($row[.]))[] |
@csv