From ea96f8e04200dbe8659465491ee1982a48894a17 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Tue, 7 Jun 2022 23:52:42 +0300 Subject: tools/video-util.sh: measure dvr_scan execution time --- tools/video-util.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tools/video-util.sh') 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 -- cgit v1.2.3