OILS / benchmarks / report.sh View on Github | oils.pub

111 lines, 69 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# benchmarks/report.sh <function name>
5
6set -o nounset
7set -o pipefail
8set -o errexit
9
10source benchmarks/common.sh # maybe-tree
11source test/common.sh # log
12
13# TODO: Move stuff from osh-parser.sh, osh-runtime.sh, etc.
14#
15# stage1 : concatenate files from different machines
16# stage2 : make CSV files with report.R
17# stage3 : make HTML files. Call 'print-report' function.
18
19
20stage2() {
21 local base_dir=$1 # _tmp/{osh-parser,osh-runtime,...}
22 local action=$(basename $base_dir)
23
24 local out=$base_dir/stage2
25 mkdir -p $out
26
27 benchmarks/report.R $action $base_dir/stage1 $out
28
29 maybe-tree $out
30}
31
32stage3() {
33 local base_dir=$1 # _tmp/{osh-parser,osh-runtime,...}
34 local name=${2:-$(basename $base_dir)}
35 local script=benchmarks/$name.sh
36
37 local out=$base_dir/index.html
38 mkdir -p $(dirname $out)
39
40 $script print-report $base_dir/stage2 > $out
41
42 echo "Wrote $out"
43}
44
45osh-parser() {
46 local base_dir=_tmp/osh-parser
47
48 benchmarks/osh-parser.sh stage1 ../benchmark-data/osh-parser
49 OILS_NO_SOUFFLE=1 stage2 $base_dir
50 stage3 $base_dir
51}
52
53osh-runtime() {
54 local base_dir=_tmp/osh-runtime
55
56 benchmarks/osh-runtime.sh stage1 ../benchmark-data/osh-runtime
57 stage2 $base_dir
58 stage3 $base_dir
59}
60
61# NOTE: This is just processing
62vm-baseline() {
63 local base_dir=_tmp/vm-baseline
64
65 benchmarks/vm-baseline.sh stage1 ../benchmark-data/vm-baseline
66 stage2 $base_dir
67 stage3 $base_dir
68}
69
70ovm-build() {
71 local base_dir=_tmp/ovm-build
72
73 benchmarks/ovm-build.sh stage1 ../benchmark-data/ovm-build
74 stage2 $base_dir
75 stage3 $base_dir
76}
77
78compute() {
79 local base_dir=_tmp/compute
80
81 benchmarks/compute.sh stage1 ../benchmark-data/compute
82 stage2 $base_dir
83 stage3 $base_dir
84}
85
86all() {
87 osh-parser
88 osh-runtime
89 vm-baseline
90 ovm-build
91 compute
92
93 # Note:
94 # benchmarks/mycpp and benchmarks/gc run on one machine, and are done in
95 # benchmarks/auto.sh
96}
97
98# For view
99dev-index() {
100 local out=_tmp/benchmarks.html
101 for name in osh-parser osh-runtime vm-baseline ovm-build; do
102 echo "<a href=\"$name/index.html\">$name</a> <br/>"
103 done > $out
104 log "Wrote $out"
105}
106
107report-test() {
108 benchmarks/report_test.R
109}
110
111"$@"