This repository was archived by the owner on Jul 13, 2025. It is now read-only.
forked from openmaptiles/openmaptiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtiming.sh
More file actions
executable file
·46 lines (41 loc) · 1.43 KB
/
timing.sh
File metadata and controls
executable file
·46 lines (41 loc) · 1.43 KB
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
#!/bin/bash
function printLog() {
time=$1; shift
difference=$1; shift
echo "$(date --iso-8601 --date="@$time") $(($difference/3600)) $@"
}
last=$(date +%s)
time=$last
<logs/update.log \
egrep --text --no-filename 'Generating zoom .*\.\.\.$|Tile generation complete!$|^(updating|quickstart|generating tiles|combining): (done|started) at|^real ' |
tail -n300 |
while read line; do
<<<$line egrep --text -q 'Generating zoom .*\.\.\.$|Tile generation complete!$' && {
time=$(<<<$line cut -b1-19 |sed --regexp-extended 's/ (.{2})-(.{2})-(.{2})/ \1:\2:\3/')
comment=$(<<<$line cut -b21-)
#different timezone. fun
time=$(date +%s --utc --date="$time")
difference=$(($time-$last))
last=$time
<<<$line egrep -q 'Tile generation complete!$' && {
comment="$lastComment $comment"
} || {
lastComment=$comment
comment='finished importing'
}
printLog $time $difference $comment
}
<<<$line egrep -q '^(updating|quickstart|generating tiles|combining): (done|started) at' && {
comment=$(<<<$line sed 's/at .*//')
time=$(<<<$line sed 's/.* at //')
time=$(date +%s --date="$time")
difference=$(($time-$last))
last=$time
<<<$line egrep -q '^updating: started at' && echo
<<<$line egrep -q '^combining: done at' && printLog $time $difference combining
}
<<<$line egrep -q '^real ' && {
difference=$(($(<<<$line sed 's/real \(.*\)m.*/\1/')*60))
printLog $time $difference "main total"
}
done