Flag SQLite queries that take more than 100ms to complete, if SQL logging is enabled

This commit is contained in:
Pragmatic Software 2017-06-18 03:37:01 -07:00
parent c8d2f8e632
commit cc3154a2c6
1 changed files with 4 additions and 1 deletions

View File

@ -43,7 +43,10 @@ sub log_message {
my $self = shift;
my $now = gettimeofday;
my $elapsed = $now - $self->{timestamp};
$elapsed = sprintf '%10.4f', $elapsed;
if ($elapsed >= 0.100) {
$self->{pbot}->{logger}->log("^^^ SLOW SQL ^^^\n");
}
$elapsed = sprintf '%10.3f', $elapsed;
$self->{pbot}->{logger}->log("$elapsed : $self->{buf}");
$self->{timestamp} = $now;
}