OILS / benchmarks / auto.sh View on Github | oilshell.org

110 lines, 56 significant
1#!/usr/bin/env bash
2#
3# Run all the benchmarks on a given machine.
4#
5# Usage:
6# benchmarks/auto.sh <function name>
7#
8# List of benchmarks:
9#
10# - Single Machine (for now):
11# - mycpp-examples
12# - gc
13# - Multiple machines
14# - osh-parser
15# - osh-runtime
16# - vm-baseline
17# - compute
18# - awk-python could be moved here
19# - startup.sh could be moved here, it also has strace counts
20# - ovm-build
21
22set -o nounset
23set -o pipefail
24set -o errexit
25
26source test/common.sh # die
27source benchmarks/common.sh # default value of OSH_OVM
28source benchmarks/id.sh
29
30measure-shells() {
31 local host_name=$1
32 local job_id=$2
33 local out_dir=$3
34
35 local host_job_id="$host_name.$job_id"
36
37 local raw_out_dir
38 raw_out_dir="$out_dir/osh-runtime/raw.$host_job_id"
39
40 # New Style doesn't need provenance -- it's joined later
41 benchmarks/osh-runtime.sh measure \
42 $host_name $raw_out_dir $OSH_CPP_BENCHMARK_DATA $out_dir
43
44 # Old style uses provenance.txt. TODO: use raw_out_dir everywhere
45 local provenance=_tmp/provenance.txt
46
47 raw_out_dir="$out_dir/vm-baseline/raw.$host_job_id"
48 benchmarks/vm-baseline.sh measure \
49 $provenance $host_job_id $out_dir/vm-baseline
50
51 raw_out_dir="$out_dir/vm-baseline/raw.$host_job_id"
52 benchmarks/osh-parser.sh measure \
53 $provenance $host_job_id $out_dir/osh-parser
54
55 raw_out_dir="$out_dir/compute/raw.$host_job_id"
56 benchmarks/compute.sh measure \
57 $provenance $host_job_id $out_dir/compute
58}
59
60measure-builds() {
61 local host_name=$1
62 local job_id=$2
63 local out_dir=$3
64
65 # TODO: Use new provenance style, like measure-shells
66 local build_prov
67 build_prov=$(benchmarks/id.sh compiler-provenance) # capture the filename
68
69 benchmarks/ovm-build.sh measure $build_prov $out_dir/ovm-build
70}
71
72# Run all benchmarks from a clean git checkout.
73# Before this, run devtools/release.sh benchmark-build.
74
75all() {
76 local do_machine1=${1:-}
77
78 local host_name
79 host_name=$(hostname) # Running on multiple machines
80
81 local job_id
82 job_id=$(print-job-id)
83
84 local host_job_id="$host_name.$job_id"
85 local out_dir='../benchmark-data'
86
87 benchmarks/id.sh shell-provenance-2 \
88 $host_name $job_id $out_dir \
89 "${SHELLS[@]}" $OSH_CPP_BENCHMARK_DATA python2
90
91 # TODO: probably move compiler-provenance here
92
93 # Notes:
94 # - During release, this happens on machine1, but not machine2
95 if test -n "$do_machine1"; then
96 # Only run on one machine
97 benchmarks/uftrace.sh soil-run
98 benchmarks/mycpp.sh soil-run
99 benchmarks/gc.sh soil-run
100 benchmarks/gc-cachegrind.sh soil-run
101
102 benchmarks/osh-parser.sh measure-cachegrind \
103 _tmp/provenance.txt $host_job_id $out_dir/osh-parser $OSH_CPP_BENCHMARK_DATA
104 fi
105
106 measure-shells $host_name $job_id $out_dir
107 measure-builds $host_name $job_id $out_dir
108}
109
110"$@"