From 52e676cfed7969d6465d73bf1496ed68962b2de5 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 1 Jul 2014 14:05:44 +0200 Subject: [PATCH] LXDebug::log_time: Differenz zum letzten Aufruf in ms mit ausgeben --- SL/LXDebug.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 { -- 2.20.1