Revision eb69ed59
Von Moritz Bunkus vor mehr als 14 Jahren hinzugefügt
SL/LXDebug.pm | ||
---|---|---|
7 | 7 |
use constant QUERY => 1 << 3; |
8 | 8 |
use constant TRACE => 1 << 4; |
9 | 9 |
use constant BACKTRACE_ON_ERROR => 1 << 5; |
10 |
use constant ALL => (1 << 6) - 1; |
|
11 |
use constant DEVEL => INFO | QUERY | TRACE | BACKTRACE_ON_ERROR; |
|
10 |
use constant REQUEST_TIMER => 1 << 6; |
|
11 |
use constant ALL => (1 << 7) - 1; |
|
12 |
use constant DEVEL => INFO | QUERY | TRACE | BACKTRACE_ON_ERROR | REQUEST_TIMER; |
|
12 | 13 |
|
13 | 14 |
use constant FILE_TARGET => 0; |
14 | 15 |
use constant STDERR_TARGET => 1; |
15 | 16 |
|
16 | 17 |
use POSIX qw(strftime); |
17 |
|
|
18 |
use Time::HiRes qw(gettimeofday tv_interval); |
|
18 | 19 |
use YAML; |
19 | 20 |
|
20 | 21 |
use strict; |
... | ... | |
227 | 228 |
join '/', qw(info debug1 debug2 query trace error_call_trace)[ grep { (reverse split //, sprintf "%05b", $_[0])[$_] } 0..5 ] |
228 | 229 |
} |
229 | 230 |
|
231 |
sub begin_request { |
|
232 |
my $self = shift; |
|
233 |
return 1 unless ($global_level & REQUEST_TIMER); |
|
234 |
$self->{request_start} = [gettimeofday]; |
|
235 |
} |
|
236 |
|
|
237 |
sub end_request { |
|
238 |
my $self = shift; |
|
239 |
return 1 unless ($global_level & REQUEST_TIMER); |
|
240 |
$self->_write("time", tv_interval($self->{request_start})); |
|
241 |
} |
|
242 |
|
|
230 | 243 |
1; |
Auch abrufbar als: Unified diff
Weiteres Debug-Level und Funktionen zur Anzeige, wie lange ein Request gedauert hat