Add linkdup_db to statistics

This commit is contained in:
Peter J. Holzer 2021-07-25 12:18:09 +02:00
parent 270c64e758
commit 19b0faad02
1 changed files with 11 additions and 0 deletions

View File

@ -717,6 +717,8 @@ sub linkdup {
} }
} }
my $tdb0 = gettimeofday();
my $tdb1;
my $sth = $self->{dbh}->prepare("select * from versions2, instances, files, sessions my $sth = $self->{dbh}->prepare("select * from versions2, instances, files, sessions
where file_type=? and file_size=? and file_mtime=? where file_type=? and file_size=? and file_mtime=?
and file_owner=? and file_group=? and file_acl=? and file_owner=? and file_group=? and file_acl=?
@ -738,6 +740,10 @@ sub linkdup {
my $st = stat($backup_filename); my $st = stat($backup_filename);
my $my_dev = defined $st ? $st->dev : ""; my $my_dev = defined $st ? $st->dev : "";
while (my $r = $sth->fetchrow_hashref()) { 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. # 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. # XXX - this should now be obsolete because we already selected only matching sessions above.
@ -780,6 +786,11 @@ sub linkdup {
} }
my $t1 = gettimeofday(); my $t1 = gettimeofday();
$self->{times}{linkdup} += $t1 - $t0; $self->{times}{linkdup} += $t1 - $t0;
unless ($tdb1) {
$tdb1 = gettimeofday();
$self->{times}{linkdup_db} += $tdb1 - $tdb0;
}
$self->{counts}{linkdup_miss}++;
return; return;
} }