From: Steinar H. Gunderson Date: Mon, 30 Oct 2023 07:59:42 +0000 (+0100) Subject: Add timing information to the local console. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=1573db8f20387b8273bafc18d9ba6f7cbc67efaf;hp=a31f1cf8248db2058d79b93fc1d6b6a12e58ba99;p=skvidarsync Add timing information to the local console. --- diff --git a/bin/sync.pl b/bin/sync.pl index e1840f2..10fcbf7 100644 --- a/bin/sync.pl +++ b/bin/sync.pl @@ -7,6 +7,7 @@ use JSON::XS; use LWP::UserAgent; use DBI; use POSIX; +use Time::HiRes; binmode STDOUT, ':utf8'; binmode STDERR, ':utf8'; use utf8; @@ -329,6 +330,8 @@ sub possibly_nag_user { } sub run { + my $start = [Time::HiRes::gettimeofday]; + @log = (); skv_log("Siste sync startet: " . POSIX::ctime(time)); @@ -590,6 +593,9 @@ sub run { push @yellow_updates, serialize_skv_log_to_sheet(); sheet_batch_update($ua, $token, \@yellow_updates); $dbh->commit; + + my $elapsed = Time::HiRes::tv_interval($start); + printf "Tok %.0f ms.\n", 1e3 * $elapsed; } if ($#ARGV >= 0 && $ARGV[0] eq '--daemon') {