Skip to content

Commit 0c999dc

Browse files
committed
WIP
1 parent 4a96f51 commit 0c999dc

File tree

7 files changed

+344
-232
lines changed

7 files changed

+344
-232
lines changed

bench/locli/report-templates/typst/main_comparison.ede

Lines changed: 58 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,69 @@
1-
#set page(paper: "a4")
1+
// To be able to load CDF data for plotting from other runs, you need to make
2+
// the root for compiling the document somewhat more permissive:
3+
//
4+
// $ typst c --root ../.. {{ typstFile }}
25

3-
// these settings make the output look more LaTeX-like
4-
// #set page(margin: 1.75in)
5-
#set par(leading: 0.55em, spacing: 0.55em, first-line-indent: 1.8em, justify: true)
6-
// #set text(font: "Ubuntu")
7-
// #show raw: set text(font: "Ubuntu Mono")
8-
#show heading: set block(above: 1.5em, below: 1.2em)
96

7+
// The suggested file name for the report PDF; you can query this by using
8+
// $ typst query --one --field value {{ typstFile }} '<export_file_name>'
9+
//
1010
#metadata("{{ report.tag }}.{{ base.fileInfix }}.pdf") <export_file_name>
1111

1212

13-
// Semibold row descriptions
14-
#show table.cell.where(x: 0): set text(weight: "semibold")
13+
// START PREAMBLE
14+
15+
16+
#import "@preview/neoplot:0.0.4" as gnuplot
17+
18+
19+
// Document Styling
20+
//
21+
#set page(paper: "a4", margin: 1.5cm)
22+
#set text(size: 10pt)
23+
#set par(leading: 0.6em, spacing: 0.8em, first-line-indent: 1.8em, justify: true)
24+
#show heading: set block(above: 1.5em, below: 1.2em)
25+
#show figure.caption: emph
26+
1527

16-
// No strokes inside table body; left alignment for row descriptions only
28+
// Table styling
29+
// No strokes inside table body; left alignment for row descriptions only; slightly smaller row descriptions
30+
//
1731
#let frame(stroke) = (x, y) => (
1832
left: if x > 0 { 0pt } else { stroke },
1933
right: stroke,
2034
top: if y < 2 { stroke } else { 0pt },
2135
bottom: stroke,
2236
)
2337
#set table(
24-
stroke: frame(1pt),
25-
align: (x, _) => if x == 0 { left } else { right }
38+
stroke: frame(0.5pt),
39+
align: (x, _) => if x == 0 { left } else { right },
2640
)
41+
// supposed to do the trick, but doesn't :( #show table: set par(leading: 0.4em)
42+
#show table.cell.where(x: 0): set text(size: 0.95em)
2743

28-
// table coloring
29-
#let gr(c) = table.cell(fill: green.lighten(60%))[c]
3044

45+
// Table cell coloring
46+
// The function names have to be in sync with Cardano.Report.colorCode in package locli
47+
//
48+
#let gr(body) = table.cell(fill: green.lighten(60%))[#body]
49+
#let rd(body) = table.cell(fill: red.lighten(60%))[#body]
3150

32-
// #+CONSTANTS: base=../../{{ base.meta.tag }}/analysis
33-
// {% for run in runs %}
34-
// #+CONSTANTS: run{{ run.index }}=../../{{ run.value.meta.tag }}/analysis
51+
// END PREAMBLE
3552

3653

54+
#align(center + horizon)[
55+
#text(size: 24pt)[
56+
{{ report.target }} against {{ base.ver }}
57+
]
3758

38-
The Title Page
39-
40-
{{ report.target }} against {{ base.ver }}
41-
42-
{{ base.workload }} workload
43-
{{ report.author }}, Cardano Performance team
44-
{{ report.date }}
59+
#text(size: 16pt)[
60+
{{ base.workload }} workload \
61+
#pad(top: 50%,[
62+
{{ report.author }}, Cardano Performance & Tracing \
63+
{{ report.date }}
64+
])
65+
]
66+
]
4567

4668
#pagebreak()
4769

@@ -55,14 +77,23 @@ The Title Page
5577

5678
= Manifest
5779

80+
#pad(bottom: 10pt,[
5881
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.
82+
])
5983

6084
{% include "table_summary.ede" with table = summary %}
6185

6286
#pagebreak()
6387

6488
= Analysis
6589

90+
{% for section in analyses %}
91+
== {{ section.value.title }}
92+
93+
{% include "table_summary.ede" with table = section.value %}
94+
#pad(top: 10pt)[]
95+
96+
{% endfor %}
6697

6798
#pagebreak()
6899

@@ -92,6 +123,9 @@ We compare {% for run in runs %}{%if !run.first%}{%if !run.last%}, {%else%} and
92123

93124
== Cluster performance charts
94125

126+
{% for c in charts %}
127+
{%include "report_gnuplot.ede" with chart = c.value %}
128+
{% endfor %}
95129

96130
#pagebreak()
97131

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
{% for run in runs %}
3+
#let input_{{ run.index }} = read("../../{{ run.value.meta.tag }}/analysis/cdf/{{ chart.deField }}.cdf")
4+
{% endfor %}
5+
#figure(
6+
gnuplot.exec(
7+
```gnuplot
8+
reset
9+
set term svg size 800,512 lw 0.8
10+
set title "{{ chart.deField }}"
11+
set style data linespoints
12+
set ytics nomirror
13+
14+
set xrange [*:*]
15+
16+
{% for run in runs %}
17+
$input_{{ run.index }} <<EOD
18+
19+
```.text + input_{{ run.index }} + ```gnuplot
20+
21+
EOD
22+
{% endfor %}
23+
24+
set ylabel "Centile, fraction of sample population"
25+
set xlabel "{{ chart.deUnit }}"
26+
plot \
27+
{% for run in runs %}
28+
$input_{{ run.index }} using 2:1 t '{{ run.value.meta.ident }}', \
29+
{% endfor %}
30+
31+
```.text
32+
),
33+
caption: "{{ chart.deShortDesc }}",
34+
gap: 0.45em,
35+
)

bench/locli/report-templates/typst/table_summary.ede

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
2+
#align(center)[
33
#table(
44
columns: {{ table.header | length }},
55

@@ -11,3 +11,4 @@
1111
{% for col in row.value %}{{ col.value.cont | justifyRight(col.value.width) }}, {% endfor %}
1212
{% endfor %}
1313
)
14+
]

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Cardano.Prelude hiding (head, show)
66

77
import Data.CDF
88
import Data.String (fromString)
9-
import Data.Text (unpack)
9+
import Data.Text (pack, unpack)
1010

1111
import Cardano.JSON
1212
import Cardano.Util
@@ -58,11 +58,11 @@ renderUnit :: Unit -> Text
5858
renderUnit = \case
5959
Sec -> "s"
6060
Hz -> "Hz"
61-
B -> "B"
62-
KB -> "KB"
63-
MB -> "MB"
64-
KBs -> "KB/s"
65-
MBs -> "MB/s"
61+
B -> "Bytes"
62+
KB -> "KiB"
63+
MB -> "MiB"
64+
KBs -> "KiB/s"
65+
MBs -> "MiB/s"
6666
Era -> "era"
6767
Epo -> "epoch"
6868
Slo -> "slots"
@@ -71,16 +71,16 @@ renderUnit = \case
7171
Hos -> "host"
7272
Sig -> "+/-"
7373
Pct -> "%"
74-
Ev -> "#"
75-
KEv -> "#"
74+
Ev -> "events"
75+
KEv -> "10³ events"
7676
Dat -> "on"
7777
Tim -> "at"
7878
Ver -> "v"
7979
Ix -> "[]"
80-
Len -> "#"
81-
Cnt -> "#"
82-
Rto -> "/"
83-
Uni -> "#"
80+
Len -> "items"
81+
Cnt -> "count"
82+
Rto -> pack "\x2236"
83+
Uni -> "units"
8484
Id -> ""
8585

8686
data Width

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,11 @@ instance CDFFields BlockProp p where
324324
"For each host, number of blocks made during the entire observation period"
325325

326326
, fGrpF' "cdfBlocksFilteredRatio" "fltrd" Rto P3 Lin R01 (DFloat cdfBlocksFilteredRatio)
327-
"Filtered to chained block ratio"
327+
"Filtered to chained blocks"
328328
"For each host, ratio of blocks that passed filtering / all on chain"
329329

330330
, fGrpF' "cdfBlocksChainedRatio" "chaind" Rto P3 Lin R01 (DFloat cdfBlocksChainedRatio)
331-
"Chained to forged block ratio"
331+
"Chained to forged blocks"
332332
"For each host, ratio of blocks that made into chain / all forged"]
333333

334334
<> fBoth "cdfBlockBattle" "Battl" " #" W4 Blk P0 Lin Free (DInt cdfBlockBattle)

bench/locli/src/Cardano/Command.hs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -854,22 +854,19 @@ runChainCommand s c@(Compare ede mTmpl outf@(TextOutputFile outfp) runs) = do
854854
liftIO . unlessM (IO.fileExist tmplPath) $
855855
BS.writeFile tmplPath tmpl
856856

857-
(tmpl', tmplEnv', typstReport) <- case xs of
857+
858+
let typstPath = Cardano.Util.replaceExtension outfp "typ"
859+
(tmplEnv', typstReport) <- case xs of
858860
baseline:deltas@(_:_) -> liftIO $ do
859-
Cardano.Report.generateTypst ede mTmpl baseline deltas
861+
Cardano.Report.generateTypst (takeFileName typstPath) baseline deltas
860862
_ -> throwE $ CommandError c $ mconcat
861863
[ "At least two runs required for comparison." ]
862864
liftIO $
863865
withFile (outfp `System.FilePath.replaceExtension` "env.typ.json") WriteMode $
864866
\hnd -> BS8.hPutStrLn hnd tmplEnv'
865-
let typstPath = Cardano.Util.replaceExtension outfp "typ"
866867
dumpText "report" [typstReport] (TextOutputFile typstPath)
867868
& firstExceptT (CommandError c)
868869

869-
let tmplPath' = Cardano.Util.replaceExtension outfp "typ.ede"
870-
liftIO . unlessM (IO.fileExist tmplPath) $
871-
BS.writeFile tmplPath' tmpl'
872-
873870
pure s
874871

875872
missingCommandData :: ChainCommand -> [String] -> ExceptT CommandError IO a

0 commit comments

Comments
 (0)