Revision 592ca077
Von Sven Schöling vor mehr als 14 Jahren hinzugefügt
SL/LXDebug.pm | ||
---|---|---|
75 | 75 |
my ($dummy1, $self_filename, $self_line) = caller(0); |
76 | 76 |
|
77 | 77 |
my $indent = " " x $self->{"calldepth"}++; |
78 |
my $time = $self->want_request_timer ? $self->get_request_time : ''; |
|
78 | 79 |
|
79 | 80 |
if (!defined($package)) { |
80 |
$self->_write('sub' . $level, $indent . "\\ top-level?\n"); |
|
81 |
$self->_write('sub' . $level, $indent . "\\ $time top-level?\n");
|
|
81 | 82 |
} else { |
82 | 83 |
$self->_write('sub' . $level, $indent |
83 |
. "\\ ${subroutine} in " |
|
84 |
. "\\ $time ${subroutine} in "
|
|
84 | 85 |
. "${self_filename}:${self_line} called from " |
85 | 86 |
. "${filename}:${line}\n"); |
86 | 87 |
} |
... | ... | |
98 | 99 |
my ($dummy1, $self_filename, $self_line) = caller(0); |
99 | 100 |
|
100 | 101 |
my $indent = " " x --$self->{"calldepth"}; |
102 |
my $time = $self->want_request_timer ? $self->get_request_time : ''; |
|
101 | 103 |
|
102 | 104 |
if (!defined($package)) { |
103 |
$self->_write('sub' . $level, $indent . "/ top-level?\n"); |
|
105 |
$self->_write('sub' . $level, $indent . "/ $time top-level?\n");
|
|
104 | 106 |
} else { |
105 |
$self->_write('sub' . $level, $indent . "/ ${subroutine} in " . "${self_filename}:${self_line}\n"); |
|
107 |
$self->_write('sub' . $level, $indent . "/ $time ${subroutine} in " . "${self_filename}:${self_line}\n");
|
|
106 | 108 |
} |
107 | 109 |
return 1; |
108 | 110 |
} |
... | ... | |
231 | 233 |
|
232 | 234 |
sub begin_request { |
233 | 235 |
my $self = shift; |
234 |
return 1 unless ($global_level & REQUEST_TIMER);
|
|
235 |
$self->{request_start} = [gettimeofday];
|
|
236 |
return 1 unless want_request_timer();
|
|
237 |
$self->set_request_timer;
|
|
236 | 238 |
} |
237 | 239 |
|
238 | 240 |
sub end_request { |
239 | 241 |
my $self = shift; |
240 |
return 1 unless ($global_level & REQUEST_TIMER);
|
|
241 |
$self->_write("time", tv_interval($self->{request_start}));
|
|
242 |
return 1 unless want_request_timer();
|
|
243 |
$self->_write("time", $self->get_request_time);
|
|
242 | 244 |
|
243 | 245 |
$self->{calldepth} = 0; |
244 | 246 |
} |
245 | 247 |
|
248 |
sub get_request_time { |
|
249 |
my $self = shift; |
|
250 |
tv_interval($self->{request_start}); |
|
251 |
} |
|
252 |
|
|
253 |
sub set_request_timer { |
|
254 |
my $self = shift; |
|
255 |
$self->{request_start} = [gettimeofday]; |
|
256 |
} |
|
257 |
|
|
258 |
sub want_request_timer { |
|
259 |
$global_level & REQUEST_TIMER; |
|
260 |
} |
|
261 |
|
|
246 | 262 |
1; |
Auch abrufbar als: Unified diff
feineres times wenn trace & requesttimer an sind.