forked from hiraditya/profile-guided-opt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgo.sh
executable file
·34 lines (27 loc) · 816 Bytes
/
go.sh
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
#!/bin/bash -xe
#mkdir build
#cd build
SRC_DIR=..
SRC_NAME=test.cpp
SRC=$SRC_DIR/$SRC_NAME
echo "Test instrumented program"
g++ -O3 -march=native -mtune=native -fprofile-arcs -ftest-coverage -o test.instr $SRC
perf stat ./test.instr 32 3
# gcov needs source file in the same directory as the profile (by default).
cp $SRC .
gcov $SRC_NAME
rm $SRC_NAME
echo "Test profile opt program"
g++ -O3 -march=native -mtune=native -fprofile-use -o test.prof.opt $SRC
perf stat ./test.prof.opt 32 3
echo "Test optmized program"
g++ -O3 -march=native -mtune=native -o test.opt $SRC
perf stat ./test.opt 32 3
generate_gprof_data () {
g++ -O3 -march=native -mtune=native -pg -fprofile-generate -o test.instr $SRC
perf stat ./test.instr 32 3
}
# This is meant to run from the build directory.
clean() {
rm *
}