summaryrefslogtreecommitdiff
path: root/ckt0.sh
diff options
context:
space:
mode:
authorwukong <wukong@longaeva>2025-11-22 00:02:20 -0800
committerwukong <wukong@longaeva>2025-11-22 00:02:20 -0800
commite9d3488a9ef1a1b5bf8e75afc719b3cce68b9853 (patch)
tree57e82d152261d445bdfc69b91d611d86236103a9 /ckt0.sh
initial commit. ckt0.awk is launched from ckt0.sh with state stored in a shell variable.
Diffstat (limited to '')
-rw-r--r--ckt0.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/ckt0.sh b/ckt0.sh
new file mode 100644
index 0000000..8b9e785
--- /dev/null
+++ b/ckt0.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env sh
+
+# estimate sytem boot time
+
+# [debug] enable execution tracing
+#set -x
+set -e
+
+# raw input data
+#date +%s
+sysctl_t0_str=$( sysctl kern.boottime | mawk -F= '{print($NF)}' )
+sysctl_t0=$( date -jf "%a %b %d %H:%M:%S %G" "${sysctl_t0_str}" +%s )
+
+#epsilon1="$( mawk 'BEGIN{print(rand()^2.0)}' )"
+#t0_est="${sysctl_t0} $(date +%s)"
+#t0_est="${sysctl_t0} ${sysctl_t0}"
+#t0_est="${sysctl_t0} ${epsilon1}"
+#t0_est="${sysctl_t0} 1.0"
+
+if [ -f t0_est.log ] ; then {
+ t0_est="$( cat t0_est.log )"
+} else {
+ t0_est="${sysctl_t0} 2.0"
+} fi
+
+printf "N t0_est t0_unc\n" | column -t
+for N in $(seq 0 1440) ; do
+ printf "${N} ${t0_est}\n" | column -t
+ #t0_est=$( mawk -f ckt0.awk ${t0_est} | tail -n2 )
+ mawk -f ckt0.awk ${sysctl_t0} 2.0
+ sleep $( mawk 'BEGIN {print( rand()^2.0 + 1.0 )}' )
+ #sleep $( echo $t0_est | mawk '{print(sqrt(1.0 + ((60.0*$NF)/(60.0 + $NF))^2.0 + rand()^2.0 ))}' )
+done
+
+printf "${t0_est}\n" | tee t0_est.log
+
+# [debug] disable execution tracing
+set +x