-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbm_combine.sh
executable file
·39 lines (36 loc) · 1.38 KB
/
bm_combine.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
#!/bin/bash
BM_FIELD=${BM_FIELD:-realtime}
if [ -f $BM_OUTPUT ]; then
mv $BM_OUTPUT $BM_OUTPUT.save
fi
if [ "x$BM_RESULT_SET" != "x" ]; then
for result in ${BM_RESULT_SET}*~*.txt; do
if ! echo $result | grep -q +mmap && ! echo $result | grep -q N; then
method="direct"
if echo $result | grep -q "+"; then
method=$(echo $result | cut -d~ -f1 | cut -d+ -f2)
fi
format_suffix=$(echo $result | cut -d~ -f2)
compression=$(echo $format_suffix | cut -d. -f1)
container=$(echo $format_suffix | cut -d. -f2)
format="$container+$method-$compression"
grep "^${BM_FIELD}" $result | awk -v format=$format \
'{ for(i=2; i<NF; i++) printf "%s",$i OFS; if(NF) printf "%s",$NF; printf ORS} BEGIN {printf "%s ", format}' \
>> $BM_OUTPUT
fi
done
else
for result in $@; do
method="direct"
if echo $result | grep -q "+"; then
method=$(echo $result | cut -d~ -f1 | cut -d+ -f2)
fi
sample=$(echo $result | cut -d. -f2 | cut -d+ -f1 | cut -d~ -f1)
format_suffix=$(echo $result | cut -d~ -f2)
compression=$(echo $format_suffix | cut -d. -f1)
format="$sample+$method-$compression"
grep "^${BM_FIELD}" $result | awk -v format=$format \
'{ for(i=2; i<NF; i++) printf "%s",$i OFS; if(NF) printf "%s",$NF; printf ORS} BEGIN {printf "%s ", format}' \
>> $BM_OUTPUT
done
fi