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

65 lines, 38 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# benchmarks/callgrind.sh <function name>
5
6set -o nounset
7set -o pipefail
8set -o errexit
9
10build-and-run() {
11 local sh=$1
12 shift
13 ninja $sh
14 valgrind --tool=callgrind $sh "$@"
15}
16
17osh-run() {
18 build-and-run _bin/cxx-dbg/osh "$@"
19}
20
21ysh-run() {
22 build-and-run _bin/cxx-dbg/ysh "$@"
23}
24
25fib() {
26 osh-run benchmarks/compute/fib.sh 10 44
27}
28
29pretty() {
30 # takes 44 seconds to collect 1.6 MB of data
31 # benchmarks/testdata/functions
32
33 # Measure one of our own scripts
34 # Takes 3 seconds
35 time osh-run -n --ast-format text install
36}
37
38parse-cpython-configure() {
39 # Goal: eliminate string slicing in this workload! It should just be
40 # creating fixed size Tokens, syntax.asdl nodes, and List<T>
41
42 ysh-run -n --ast-format none Python-2.7.13/configure
43}
44
45json() {
46 # 50 lines
47 ysh-run test/bug-2123.ysh 50
48}
49
50with-callgrind() {
51 local out_file=$1 # Ignored for now, same interface as with-cachegrind
52 shift
53
54 valgrind --tool=callgrind \
55 "$@"
56}
57
58install-kcachegrind() {
59 sudo apt-get install kcachegrind
60}
61
62file=$(basename $0)
63if test $file = 'callgrind.sh'; then
64 "$@"
65fi