summaryrefslogtreecommitdiff
path: root/ckcptime.sh
blob: 466af597edff2b7fd0e7fde4a4d459a24109dd1b (plain) (blame)
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
#!/usr/bin/env sh

# estimate sytem boot time

# [debug] enable execution tracing
# set -x
set -e

# raw input data
#date +%s
#sysctl kern.cp_time | awk -F= '{print($0)}'

t_prev='0'
t_curr=$( date +%s )

for N in $( seq 0 90 ) ; do
    while [ $t_prev -eq $t_curr ] ; do
        # sleep $( awk 'BEGIN {print(rand()^2.0 + rand()^2.0)}' )
        # sleep 0.707107
        sleep 1.41421
        t_curr=$( date +%s )
    done
    if [ $t_prev -ne $t_curr ] ; then
        awk -f ckcptime.awk
        t_prev=$t_curr
    fi

done

# [debug] disable execution tracing
set +x