line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
1937
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
67
|
|
2
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
106
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Display execution times |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.003029'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Devel::REPL::Plugin; |
8
|
2
|
|
|
2
|
|
11
|
use Time::HiRes 'time'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
9
|
2
|
|
|
2
|
|
8133
|
use namespace::autoclean; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
19
|
|
10
|
2
|
|
|
2
|
|
370
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
11
|
|
|
|
|
|
|
around 'eval' => sub { |
12
|
|
|
|
|
|
|
my $orig = shift; |
13
|
|
|
|
|
|
|
my ($self, $line) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my @ret; |
16
|
|
|
|
|
|
|
my $start = time; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
if (wantarray) { |
19
|
|
|
|
|
|
|
@ret = $self->$orig($line); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
else { |
22
|
|
|
|
|
|
|
$ret[0] = $self->$orig($line); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$self->print("Took " . (time - $start) . " seconds.\n"); |
26
|
|
|
|
|
|
|
return @ret; |
27
|
|
|
|
|
|
|
}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=pod |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=encoding UTF-8 |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Devel::REPL::Plugin::Timing - Display execution times |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 VERSION |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
version 1.003029 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# in your re.pl file: |
47
|
|
|
|
|
|
|
use Devel::REPL; |
48
|
|
|
|
|
|
|
my $repl = Devel::REPL->new; |
49
|
|
|
|
|
|
|
$repl->load_plugin('Timing'); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# after you run re.pl: |
52
|
|
|
|
|
|
|
$ sum map $_*100, 1..100000; |
53
|
|
|
|
|
|
|
Took 0.0830280780792236 seconds. |
54
|
|
|
|
|
|
|
500005000000 |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$ |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SUPPORT |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL> |
61
|
|
|
|
|
|
|
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>). |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
64
|
|
|
|
|
|
|
L<C<#devel> on C<irc.perl.org>|irc://irc.perl.org/#devel-repl>. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 AUTHOR |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Shawn M Moore, C<< <sartak at gmail dot com> >> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
This software is copyright (c) 2007 by Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>). |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
75
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |