From 19b0faad029ba0661ce63ee088a3afcb22071720 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sun, 25 Jul 2021 12:18:09 +0200 Subject: [PATCH] Add linkdup_db to statistics --- lib/Simba/CA.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Simba/CA.pm b/lib/Simba/CA.pm index 964f591..15a624e 100644 --- a/lib/Simba/CA.pm +++ b/lib/Simba/CA.pm @@ -717,6 +717,8 @@ sub linkdup { } } + my $tdb0 = gettimeofday(); + my $tdb1; my $sth = $self->{dbh}->prepare("select * from versions2, instances, files, sessions where file_type=? and file_size=? and file_mtime=? and file_owner=? and file_group=? and file_acl=? @@ -738,6 +740,10 @@ sub linkdup { my $st = stat($backup_filename); my $my_dev = defined $st ? $st->dev : ""; while (my $r = $sth->fetchrow_hashref()) { + unless ($tdb1) { + $tdb1 = gettimeofday(); + $self->{times}{linkdup_db} += $tdb1 - $tdb0; + } # check if old file is on same device. If it isn't, skip it. # XXX - this should now be obsolete because we already selected only matching sessions above. @@ -780,6 +786,11 @@ sub linkdup { } my $t1 = gettimeofday(); $self->{times}{linkdup} += $t1 - $t0; + unless ($tdb1) { + $tdb1 = gettimeofday(); + $self->{times}{linkdup_db} += $tdb1 - $tdb0; + } + $self->{counts}{linkdup_miss}++; return; }