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 | fib() {
|
11 | # Hm dbg build seems to give more exact info
|
12 | local osh=_bin/cxx-dbg/osh
|
13 | #local osh=_bin/cxx-opt/osh
|
14 |
|
15 | ninja $osh
|
16 |
|
17 | valgrind --tool=callgrind \
|
18 | $osh benchmarks/compute/fib.sh 10 44
|
19 | }
|
20 |
|
21 | with-callgrind() {
|
22 | local out_file=$1 # Ignored for now, same interface as with-cachegrind
|
23 | shift
|
24 |
|
25 | valgrind --tool=callgrind \
|
26 | "$@"
|
27 | }
|
28 |
|
29 | install-kcachegrind() {
|
30 | sudo apt-get install kcachegrind
|
31 | }
|
32 |
|
33 | file=$(basename $0)
|
34 | if test $file = 'callgrind.sh'; then
|
35 | "$@"
|
36 | fi
|