-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgprof.sh
More file actions
executable file
·45 lines (35 loc) · 834 Bytes
/
gprof.sh
File metadata and controls
executable file
·45 lines (35 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
NINJA_FILE="build.linux.ninja"
case "$(uname)" in
"Darwin")
NINJA_FILE="build.osx.ninja"
;;
"Linux")
NINJA_FILE="build.linux.ninja"
;;
*)
echo "Unsupported Operating System: $(uname)"
exit 1
;;
esac
if [[ "${BASHOPTS}" != *extdebug* ]]; then
set -e
fi
err_report() {
cd ${cwd}
echo "ERROR: $0:$*"
exit 8
}
if [[ "${BASHOPTS}" != *extdebug* ]]; then
trap 'err_report $LINENO' ERR
fi
cwd=$(cd "$(dirname $(dirname "${BASH_SOURCE[0]}"))" &> /dev/null && pwd)
cd ${cwd}
# cleanup
ninja -f $NINJA_FILE -t clean > /dev/null 2>&1
# gprof target
ninja -f $NINJA_FILE perf-gprof
ninja -f $NINJA_FILE -t clean > /dev/null 2>&1
./test-perf-gprof
gprof ./test-perf-gprof gmon.out > test-perf-gprof.txt
[[ -f gmon.out ]] && rm gmon.out