aboutsummaryrefslogtreecommitdiff
path: root/contrib/cirrus/timestamp.awk
blob: b3663b303ff5d1e2910a8a2d7f0d4664de983106 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# This script is intended to be piped into by automation, in order to
# mark output lines with timing information.  For example:
#      /path/to/command |& awk --file timestamp.awk

BEGIN {
    STARTTIME=systime()
    printf "[%s] START", strftime("%T")
    printf " - All [+xxxx] lines that follow are relative to %s.\n", strftime("%FT%T")
}

{
    printf "[%+05ds] %s\n", systime()-STARTTIME, $0
}

END {
    printf "[%s] END", strftime("%T")
    printf " - [%+05ds] total duration since %s\n", systime()-STARTTIME, strftime("%FT%T")
}