OILS / benchmarks / gc-cachegrind.sh View on Github | oilshell.org

86 lines, 30 significant
1#!/usr/bin/env bash
2#
3# Take stable measurements of GC
4#
5# Usage:
6# benchmarks/gc-cachegrind.sh <function name>
7
8set -o nounset
9set -o pipefail
10set -o errexit
11
12REPO_ROOT=$(cd "$(dirname $0)/.."; pwd)
13
14source benchmarks/common.sh
15source build/dev-shell.sh # $R_LIBS_USER
16source test/tsv-lib.sh
17
18readonly BASE_DIR=_tmp/gc-cachegrind
19
20print-report() {
21 local in_dir=$1
22
23 benchmark-html-head 'Memory Management (stable measurements)'
24
25 cat <<EOF
26 <body class="width60">
27 <p id="home-link">
28 <a href="/">oilshell.org</a>
29 </p>
30EOF
31
32 cmark << 'EOF'
33## Memory Management (stable measurements)
34
35Source code: [oil/benchmarks/gc-cachegrind.sh](https://github.com/oilshell/oil/tree/master/benchmarks/gc-cachegrind.sh)
36EOF
37
38 cmark <<'EOF'
39#### parse.abuild
40
41EOF
42
43 tsv2html $in_dir/parse.abuild.tsv
44
45 cmark <<'EOF'
46#### ex.compute-fib
47
48EOF
49
50 tsv2html $in_dir/ex.compute-fib.tsv
51
52
53 cat <<EOF
54
55 </body>
56</html>
57EOF
58}
59
60make-report() {
61 mkdir -p $BASE_DIR/{stage1,stage2}
62
63 # Concatenate tiny files
64 benchmarks/cachegrind_to_tsv.py $BASE_DIR/raw/cachegrind-*.txt \
65 > $BASE_DIR/stage1/cachegrind.tsv
66
67 #pretty-tsv $BASE_DIR/stage1/cachegrind.tsv
68
69 # Make TSV files
70 benchmarks/report.R gc-cachegrind $BASE_DIR $BASE_DIR/stage2
71
72 #pretty-tsv $BASE_DIR/stage2/counts.tsv
73
74 # Make HTML
75 benchmarks/report.sh stage3 $BASE_DIR
76}
77
78soil-run() {
79 ### Run in soil/benchmarks2 (stable timings)
80
81 benchmarks/gc.sh measure-cachegrind
82
83 make-report
84}
85
86"$@"