Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Test/Deep/MM.pm |
Statements | Executed 39 statements in 365µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 57µs | 62µs | import | Test::Deep::MM::
1 | 1 | 1 | 12µs | 14µs | BEGIN@1 | Test::Deep::Stack::
1 | 1 | 1 | 8µs | 22µs | BEGIN@16 | Test::Deep::MM::
1 | 1 | 1 | 6µs | 14µs | BEGIN@2 | Test::Deep::Stack::
1 | 1 | 1 | 6µs | 14µs | BEGIN@31 | Test::Deep::MM::
4 | 1 | 1 | 4µs | 4µs | CORE:match (opcode) | Test::Deep::MM::
0 | 0 | 0 | 0s | 0s | __ANON__[:25] | Test::Deep::MM::
0 | 0 | 0 | 0s | 0s | __ANON__[:28] | Test::Deep::MM::
0 | 0 | 0 | 0s | 0s | init | Test::Deep::MM::
0 | 0 | 0 | 0s | 0s | new | Test::Deep::MM::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 3 | 16µs | 2 | 15µs | # spent 14µs (12+2) within Test::Deep::Stack::BEGIN@1 which was called:
# once (12µs+2µs) by Test::Deep::Stack::BEGIN@9 at line 1 # spent 14µs making 1 call to Test::Deep::Stack::BEGIN@1
# spent 2µs making 1 call to strict::import |
2 | 3 | 65µs | 2 | 22µs | # spent 14µs (6+8) within Test::Deep::Stack::BEGIN@2 which was called:
# once (6µs+8µs) by Test::Deep::Stack::BEGIN@9 at line 2 # spent 14µs making 1 call to Test::Deep::Stack::BEGIN@2
# spent 8µs making 1 call to warnings::import |
3 | |||||
4 | package Test::Deep::MM; | ||||
5 | |||||
6 | sub import | ||||
7 | # spent 62µs (57+5) within Test::Deep::MM::import which was called:
# once (57µs+5µs) by Test::Deep::Stack::BEGIN@9 at line 9 of Test/Deep/Stack.pm | ||||
8 | 26 | 63µs | my $self = shift; | ||
9 | |||||
10 | my ($pkg) = caller(); | ||||
11 | my $mpkg = $pkg."::Methods"; | ||||
12 | foreach my $attr (@_) | ||||
13 | { | ||||
14 | 4 | 4µs | if ($attr =~ /^[a-z]/) # spent 4µs making 4 calls to Test::Deep::MM::CORE:match, avg 1µs/call | ||
15 | { | ||||
16 | 3 | 99µs | 2 | 37µs | # spent 22µs (8+15) within Test::Deep::MM::BEGIN@16 which was called:
# once (8µs+15µs) by Test::Deep::Stack::BEGIN@9 at line 16 # spent 22µs making 1 call to Test::Deep::MM::BEGIN@16
# spent 14µs making 1 call to strict::unimport |
17 | *{$mpkg."::$attr"} = \&{$attr}; | ||||
18 | } | ||||
19 | else | ||||
20 | { | ||||
21 | my $get_name = $mpkg."::get$attr"; | ||||
22 | my $set_name = $mpkg."::set$attr"; | ||||
23 | my $get_sub = sub { | ||||
24 | return $_[0]->{$attr}; | ||||
25 | }; | ||||
26 | my $set_sub = sub { | ||||
27 | return $_[0]->{$attr} = $_[1]; | ||||
28 | }; | ||||
29 | |||||
30 | { | ||||
31 | 3 | 120µs | 2 | 22µs | # spent 14µs (6+8) within Test::Deep::MM::BEGIN@31 which was called:
# once (6µs+8µs) by Test::Deep::Stack::BEGIN@9 at line 31 # spent 14µs making 1 call to Test::Deep::MM::BEGIN@31
# spent 8µs making 1 call to strict::unimport |
32 | *$get_name = $get_sub; | ||||
33 | *$set_name = $set_sub; | ||||
34 | push(@{$pkg."::ISA"}, $mpkg); | ||||
35 | } | ||||
36 | } | ||||
37 | } | ||||
38 | } | ||||
39 | |||||
40 | sub new | ||||
41 | { | ||||
42 | my $pkg = shift; | ||||
43 | |||||
44 | my $self = bless {}, $pkg; | ||||
45 | |||||
46 | $self->init(@_); | ||||
47 | |||||
48 | return $self; | ||||
49 | } | ||||
50 | |||||
51 | sub init | ||||
52 | { | ||||
53 | my $self = shift; | ||||
54 | |||||
55 | while (@_) | ||||
56 | { | ||||
57 | my $name = shift || confess("No name"); | ||||
58 | |||||
59 | my $method = "set$name"; | ||||
60 | $self->$method(shift); | ||||
61 | } | ||||
62 | } | ||||
63 | |||||
64 | 1 | 2µs | 1; | ||
# spent 4µs within Test::Deep::MM::CORE:match which was called 4 times, avg 1µs/call:
# 4 times (4µs+0s) by Test::Deep::MM::import at line 14, avg 1µs/call |