-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathvars.sh
151 lines (113 loc) · 3.39 KB
/
vars.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# if 0, redirect benchmark output to /dev/null
# if 1, print benchmark output to stdout
[[ -n $DEBUG ]] || DEBUG=0
# Specify the timeout. Default is INF(0)
[[ -n $RUNTIME ]] || RUNTIME=0
# Execute the benchmark
[[ -n $EXEC ]] || EXEC=1
# Compile
[[ -n $COMPILE ]] || COMPILE=1
# Instrument
[[ -n $INSTRUMENT ]] || INSTRUMENT=0
# JOBS
[[ -n $JOBS ]] || JOBS=1
# ANALYZE
[[ -n $ANALYZE ]] || ANALYZE=0
# INSTRUMENT
[[ -n $INSTRUMENT ]] || INSTRUMENT=0
# DIFF
[[ -n $DIFF ]] || DIFF=0
[[ $DIFF -eq 1 && $DEBUG -eq 1 ]] && {
echo "Can't use DIFF=1 & DEBUG=1 at the same time"
exit 1
}
# Remove all temp files
[[ -n CLEAN ]] || CLEAN=0
# Set the lib suffix.
suffix="dylib"
if [[ $(uname -s) == "Linux" ]]; then
suffix="so"
fi
# if we're on osx, we must use `gtimeout` instead of `timeout`
# `gtimeout` can be download from homebrew
TIMEOUT=timeout
if [[ $(uname -s) == "Darwin" ]]; then
TIMEOUT=gtimeout
fi
# -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # --
# LLVM_PATH => The place where I have all the LLVM tools
LLVM_PATH=""
[[ -d "${LLVM_PATH}" ]] || {
echo "One must define LLVM_PATH before running tf"
exit 1
}
# -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # --
# THIS PART IS LEFT AS AN EXAMPLE FOR THE PEOPLE WORKING WITH PIN!
# PIN
[[ -n $PIN ]] || PIN=0
if [[ $PIN -eq 1 ]]; then
# PIN_PATH => The place where I keep the pin source code
PIN_PATH=""
[[ -n $PIN_PATH ]] || {
echo "One must define the PIN before when PIN=1"
exit 1
}
# PIN_LIB => The place where I keep the Pin lib implemented.
PIN_LIB=""
[[ -n $PIN_LIB ]] || {
echo "One must define PIN_LIB when PIN=1"
exit 1
}
# PIN_TOOL => The tool used
[[ -z $PIN_TOOL ]] || {
echo "You must define a PIN_TOOL variable before using tf with PIN"
exit 1
}
# PIN_FLAGS => Flags to pass to PIN
[[ -n $PIN_FLAGS ]] || PIN_FLAGS=" "
echo "PIN_PATH is set to $PIN_PATH"
echo "PIN_LIB is set to $PIN_LIB"
echo "PIN_TOOL is set to $PIN_TOOL"
echo "Compiling PIN TOOLS"
PIN_ROOT=$PIN_PATH make -C $PIN_LIB || {
echo "Error compiling PIN TOOLS"
exit 1
}
fi
# -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # --
# perf
[[ -n $OCPERF ]] || OCPERF=0
if [[ $OCPERF -eq 1 ]]; then
#PERF EVENT
[[ -n $PERF_TOOL ]] || PERF_TOOL="mem_uops_retired.all_loads" # mem-stores
#USER OR KERNEL SPACE
[[ -n $PERF_TYPE ]] || PERF_TYPE="u"
#OUTPUT FILE
[[ -n $PERF_FILE ]] || PERF_FILE="perf_${PERF_TOOL}_${PERF_TYPE}.out"
PERF_BIN=""
[[ -n $PERF_BIN ]] || {
echo "One must define PERF_BIN when PERF=1"
exit 1
}
echo "PERF_BIN is set to $PERF_BIN"
echo "PERF_TOOL is set to $PERF_TOOL"
echo "PERF_TYPE is set to $PERF_TYPE"
fi
# -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # --
BASEDIR="$(pwd)"
BENCHSDIR="$BASEDIR/Benchs/"
# -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # -- # --
echo "#########################"
echo "DEBUG is set to $DEBUG"
echo "RUNTIME is set to $RUNTIME"
echo "CLEAN is set to $CLEAN"
echo "PIN is set to $PIN"
echo "EXEC is set to $EXEC"
echo "COMPILE is set to $COMPILE"
echo "INSTRUMENT is set to $INSTRUMENT"
echo "suffix is set to $suffix" # .so or .dylib
echo "BASEDIR is set to $BASEDIR"
echo "Benchmarks dir is set to $BENCHSDIR"
echo "PASS is set to $PASS"
echo "DIFF is set to $DIFF"
echo "#########################"