summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-06-07 23:52:42 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-06-07 23:52:42 +0300
commitea96f8e04200dbe8659465491ee1982a48894a17 (patch)
tree5bbfff010d4040da681c6f6906205b301bad1d15
parentc733639969a50c7db826593d2fc7f8e7899418e2 (diff)
tools/video-util.sh: measure dvr_scan execution time
-rwxr-xr-xtools/video-util.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/video-util.sh b/tools/video-util.sh
index caf925d..3ce4a3e 100755
--- a/tools/video-util.sh
+++ b/tools/video-util.sh
@@ -23,6 +23,17 @@ verbose=
config_dir=$HOME/.config/video-util
config_dir_set=
+_time_started=
+
+time_start() {
+ _time_started=$(date +%s)
+}
+
+time_elapsed() {
+ local _time_finished=$(date +%s)
+ echo $(( _time_finished - _time_started ))
+}
+
debug() {
if [ -n "$verbose" ]; then
>&2 echo "$@"
@@ -250,7 +261,9 @@ dvr_scan() {
else
echoinfo "dvr_scan($input): no roi, mt=$motion_threshold"
fi
+ time_start
dvr-scan $dvr_scan_args -i "$input" -so --min-event-length 3s -df 3 --frame-skip 2 -t $motion_threshold $args | tail -1
+ debug "dvr_scan: finished in $(time_elapsed)s"
}
[[ $# -lt 1 ]] && usage