]> git.sesse.net Git - skvidarsync/commitdiff
Add timing information to the local console.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 30 Oct 2023 07:59:42 +0000 (08:59 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 30 Oct 2023 07:59:42 +0000 (08:59 +0100)
bin/sync.pl

index e1840f271de02246c301650ed44d16d23a61ea41..10fcbf70995c75de97a85e3f0b22d6925de87a24 100644 (file)
@@ -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') {