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

30 lines, 16 significant
1#!/usr/bin/env bash
2#
3# cachegrind gives instruction counts
4#
5# Usage:
6# benchmarks/cachegrind.sh <function name>
7
8set -o nounset
9set -o pipefail
10set -o errexit
11
12source benchmarks/common.sh
13
14with-cachegrind() {
15 ### Run a command under cachegrind, writing to $out_file
16 local out_file=$1
17 shift
18
19 valgrind --tool=cachegrind \
20 --log-file=$out_file \
21 --cachegrind-out-file=/dev/null \
22 -- "$@"
23
24 log "Wrote $out_file"
25}
26
27file=$(basename $0)
28if test $file = 'cachegrind.sh'; then
29 "$@"
30fi