OILS / benchmarks / callgrind.sh View on Github | oilshell.org

56 lines, 35 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
29parse-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
36json() {
37 # 50 lines
38 ysh-run test/bug-2123.ysh 50
39}
40
41with-callgrind() {
42 local out_file=$1 # Ignored for now, same interface as with-cachegrind
43 shift
44
45 valgrind --tool=callgrind \
46 "$@"
47}
48
49install-kcachegrind() {
50 sudo apt-get install kcachegrind
51}
52
53file=$(basename $0)
54if test $file = 'callgrind.sh'; then
55 "$@"
56fi