- Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathprofdata_merge_simple
executable file
·32 lines (24 loc) · 720 Bytes
/
profdata_merge_simple
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
#!/usr/bin/env bash
set -x
set -e
PROFRAW_DIR=$1
OUTPUT_FILENAME=$2
# Reads the paths to prof data files from INPUT_FILENAME and then merges them
# into OUTPUT_FILENAME.
TARGETS=($(find ${PROFRAW_DIR} -name '*.profraw'))
if [[ ${#TARGETS[@]}-eq 0 ]];then
echo"Error! No *.profraw targets to merge!"
exit 1
fi
FIRST_TARGET=${TARGETS[0]}
xcrun -sdk macosx llvm-profdata merge -output-file=${OUTPUT_FILENAME}${FIRST_TARGET}
if [[ ${#TARGETS[@]}-eq 1 ]];then
exit 0
fi
# Reduce over the rest of the targets
fortin"${TARGETS[@]:1}";do
xcrun -sdk macosx llvm-profdata merge -o=${OUTPUT_FILENAME}.tmp ${t}${OUTPUT_FILENAME}
mv ${OUTPUT_FILENAME}.tmp ${OUTPUT_FILENAME}
done
set +e
set +x