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