forked from mjhubisz/argweaver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeanIterTime.sh
executable file
·43 lines (41 loc) · 1.02 KB
/
meanIterTime.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
#!/bin/bash
files=""
if [[ $# == 1 && -d $1 ]]; then
files=`find $1 -name "*.log"`
else
files=$@
fi
grep -B 1 "sample time" $files |
awk 'BEGIN {
sampleType[0]="leaf"
sampleType[1]="subtree"
sampleType[2]="hap"
}
$0 ~ /resample_arg_regions/ {subtree=1};
$0 ~ /resample_arg_leaf/ {subtree=0}
$0 ~ /resample_arg_by_hap/ {subtree=2}
{val=-1}
$NF=="ms" {
val=$(NF-1)/1000
}
$NF == "s" {
val = $(NF-1)
}
$NF == "m" {
val = $(NF-1)*60
}
$NF == "h" {
val = $(NF-1)*3600
}
val > 0 {
totalSec[subtree] += val;
totalCount[subtree]++;
}
END{
for (i=0; i < 3; i++) {
if (totalCount[i] > 0) {
avg=totalSec[i]/totalCount[i]/60
print sampleType[i]": "avg" m (out of "totalCount[i]")"
}
}
}'