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

107 lines, 57 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_TWO $OSH_SOUFFLE_CPP_TWO $OSH_STATIC_TWO
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_TWO $OSH_SOUFFLE_CPP_TWO $OSH_STATIC_TWO \
78 python2
79
80 # Notes:
81 # - During release, this happens on machine1, but not machine2
82 if test -n "$do_machine1"; then
83 # Only run on one machine
84 benchmarks/uftrace.sh soil-run
85 benchmarks/mycpp.sh soil-run
86 benchmarks/gc.sh run-for-release
87 benchmarks/gc-cachegrind.sh run-for-release
88
89 benchmarks/osh-parser.sh measure-cachegrind \
90 _tmp/provenance.txt $host_job_id $out_dir/osh-parser $OSH_CPP_TWO
91 fi
92
93 if test -z "${resume1:-}"; then
94 measure-shells $host_name $job_id $out_dir
95 fi
96
97 compiler-provenance-2 \
98 $host_name $job_id $out_dir
99
100 local raw_out_dir
101 raw_out_dir="$out_dir/ovm-build/raw.$host_job_id"
102
103 local build_prov=_tmp/compiler-provenance.txt
104 benchmarks/ovm-build.sh measure $build_prov $raw_out_dir
105}
106
107"$@"