From: Moritz Bunkus Date: Tue, 1 Jul 2014 12:05:44 +0000 (+0200) Subject: LXDebug::log_time: Differenz zum letzten Aufruf in ms mit ausgeben X-Git-Tag: release-3.2.0beta~404 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=52e676cfed7969d6465d73bf1496ed68962b2de5;p=kivitendo-erp.git LXDebug::log_time: Differenz zum letzten Aufruf in ms mit ausgeben --- diff --git a/SL/LXDebug.pm b/SL/LXDebug.pm index 016015f52..c2a7c594f 100644 --- a/SL/LXDebug.pm +++ b/SL/LXDebug.pm @@ -304,7 +304,12 @@ sub end_request { sub log_time { my ($self, @slurp) = @_; return 1 unless want_request_timer(); - $self->_write("time", $self->get_request_time() . (@slurp ? " (@slurp)" : '')); + + my $now = $self->get_request_time; + my $diff = int((($now - ($self->{previous_log_time} // 0)) * 10_000 + 5) / 10); + $self->{previous_log_time} = $now; + + $self->_write("time", "${now}s Δ ${diff}ms" . (@slurp ? " (@slurp)" : '')); } sub get_request_time {