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

106 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
39 raw_out_dir="$out_dir/osh-runtime/raw.$host_job_id"
40 benchmarks/osh-runtime.sh measure \
41 $host_name $raw_out_dir $OSH_CPP_BENCHMARK_DATA
42
43 # Old style uses provenance.txt. TODO: use raw_out_dir everywhere
44 local provenance=_tmp/provenance.txt
45
46 raw_out_dir="$out_dir/vm-baseline/raw.$host_job_id"
47 benchmarks/vm-baseline.sh measure \
48 $provenance $host_job_id $out_dir/vm-baseline
49
50 raw_out_dir="$out_dir/vm-baseline/raw.$host_job_id"
51 benchmarks/osh-parser.sh measure \
52 $provenance $host_job_id $out_dir/osh-parser
53
54 raw_out_dir="$out_dir/compute/raw.$host_job_id"
55 benchmarks/compute.sh measure \
56 $provenance $host_job_id $out_dir/compute
57}
58
59# Run all benchmarks from a clean git checkout.
60# Before this, run devtools/release.sh benchmark-build.
61
62all() {
63 local do_machine1=${1:-}
64 local resume1=${2:-} # skip past measure-shells
65
66 local host_name
67 host_name=$(hostname) # Running on multiple machines
68
69 local job_id
70 job_id=$(print-job-id)
71
72 local host_job_id="$host_name.$job_id"
73 local out_dir='../benchmark-data'
74
75 benchmarks/id.sh shell-provenance-2 \
76 $host_name $job_id $out_dir \
77 "${SHELLS[@]}" $OSH_CPP_BENCHMARK_DATA python2
78
79 # Notes:
80 # - During release, this happens on machine1, but not machine2
81 if test -n "$do_machine1"; then
82 # Only run on one machine
83 benchmarks/uftrace.sh soil-run
84 benchmarks/mycpp.sh soil-run
85 benchmarks/gc.sh run-for-release
86 benchmarks/gc-cachegrind.sh soil-run
87
88 benchmarks/osh-parser.sh measure-cachegrind \
89 _tmp/provenance.txt $host_job_id $out_dir/osh-parser $OSH_CPP_BENCHMARK_DATA
90 fi
91
92 if test -z "${resume1:-}"; then
93 measure-shells $host_name $job_id $out_dir
94 fi
95
96 compiler-provenance-2 \
97 $host_name $job_id $out_dir
98
99 local raw_out_dir
100 raw_out_dir="$out_dir/ovm-build/raw.$host_job_id"
101
102 local build_prov=_tmp/compiler-provenance.txt
103 benchmarks/ovm-build.sh measure $build_prov $raw_out_dir
104}
105
106"$@"