more timing info

This commit is contained in:
hjp 2009-09-25 19:58:20 +00:00
parent 582cf47a11
commit 2bc2878dd3
1 changed files with 10 additions and 2 deletions

View File

@ -390,6 +390,8 @@ sub db_record_version {
my $db_f = $self->{dbh}->selectall_arrayref("select * from files where fileset=? and path=?", my $db_f = $self->{dbh}->selectall_arrayref("select * from files where fileset=? and path=?",
{ Slice => {} }, { Slice => {} },
$target->{id}, $f->{name}); $target->{id}, $f->{name});
my $t1 = gettimeofday();
$self->{times}{db_record_version_select_files} += $t1 - $t0;
unless (@$db_f) { unless (@$db_f) {
$self->{dbh}->do("insert into files(fileset, path) values(?, ?)", $self->{dbh}->do("insert into files(fileset, path) values(?, ?)",
{}, {},
@ -399,6 +401,8 @@ sub db_record_version {
$target->{id}, $f->{name}); $target->{id}, $f->{name});
} }
my $t2 = gettimeofday();
$self->{times}{db_record_version_insert_files} += $t2 - $t1;
if ($f->{t} eq 'f' && !defined($f->{checksum})) { if ($f->{t} eq 'f' && !defined($f->{checksum})) {
# this must be a link to the previous version # this must be a link to the previous version
my $db_pv = $self->{dbh}->selectall_arrayref( my $db_pv = $self->{dbh}->selectall_arrayref(
@ -460,6 +464,8 @@ sub db_record_version {
); );
$version_id = $self->{dbh}->{mysql_insertid}; $version_id = $self->{dbh}->{mysql_insertid};
} }
my $t3 = gettimeofday();
$self->{times}{db_record_version_versions2} += $t3 - $t2;
$self->{dbh}->do("insert into instances(file, $self->{dbh}->do("insert into instances(file,
file_id, file_id,
date, online, date, online,
@ -475,10 +481,12 @@ sub db_record_version {
$self->{session_id}, $version_id $self->{session_id}, $version_id
); );
my $t1 = gettimeofday(); my $t4 = gettimeofday();
$self->{times}{db_record_version} += $t1 - $t0; $self->{times}{db_record_version_insert_instances} += $t4 - $t3;
$self->{times}{db_record_version} += $t4 - $t0;
} }
sub new_session { sub new_session {
my ($self) = @_; my ($self) = @_;
$self->{dbh}->do("insert into sessions(start_date, prefix) values(?, ?)", {}, time(), $self->{this_backup}); $self->{dbh}->do("insert into sessions(start_date, prefix) values(?, ?)", {}, time(), $self->{this_backup});