| File | /usr/local/lib/perl5/5.10.1/Test/Deep/Cache.pm |
| Statements Executed | 229 |
| Statement Execution Time | 712µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 409µs | 2.28ms | Test::Deep::Cache::BEGIN@6 |
| 19 | 1 | 1 | 206µs | 810µs | Test::Deep::Cache::cmp |
| 19 | 1 | 1 | 117µs | 643µs | Test::Deep::Cache::add |
| 1 | 1 | 1 | 47µs | 92µs | Test::Deep::Cache::new |
| 38 | 2 | 1 | 40µs | 40µs | Test::Deep::Cache::type |
| 1 | 1 | 1 | 25µs | 31µs | Test::Deep::Cache::local |
| 0 | 0 | 0 | 0s | 0s | Test::Deep::Cache::finish |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | 3 | 20µs | 2 | 17µs | use strict; # spent 14µs making 1 call to Test::Deep::BEGIN@1
# spent 3µs making 1 call to strict::import |
| 2 | 3 | 24µs | 2 | 24µs | use warnings; # spent 15µs making 1 call to Test::Deep::BEGIN@2
# spent 9µs making 1 call to warnings::import |
| 3 | |||||
| 4 | package Test::Deep::Cache; | ||||
| 5 | |||||
| 6 | 3 | 303µs | 1 | 2.28ms | # spent 2.28ms (409µs+1.87) within Test::Deep::Cache::BEGIN@6 which was called
# once (409µs+1.87ms) by Test::Deep::BEGIN@7 at line 6 # spent 2.28ms making 1 call to Test::Deep::Cache::BEGIN@6 |
| 7 | |||||
| 8 | sub new | ||||
| 9 | # spent 92µs (47+45) within Test::Deep::Cache::new which was called
# once (47µs+45µs) by Test::Deep::cmp_details at line 144 of Test/Deep.pm | ||||
| 10 | 1 | 2µs | my $pkg = shift; | ||
| 11 | |||||
| 12 | 1 | 8µs | my $self = bless {}, $pkg; | ||
| 13 | |||||
| 14 | 1 | 9µs | 1 | 11µs | $self->{expects} = [Test::Deep::Cache::Simple->new]; # spent 11µs making 1 call to Test::Deep::Cache::Simple::new |
| 15 | 1 | 3µs | 1 | 3µs | $self->{normal} = [Test::Deep::Cache::Simple->new]; # spent 3µs making 1 call to Test::Deep::Cache::Simple::new |
| 16 | |||||
| 17 | 1 | 13µs | 1 | 31µs | $self->local; # spent 31µs making 1 call to Test::Deep::Cache::local |
| 18 | |||||
| 19 | 1 | 6µs | return $self; | ||
| 20 | } | ||||
| 21 | |||||
| 22 | sub add | ||||
| 23 | # spent 643µs (117+527) within Test::Deep::Cache::add which was called 19 times, avg 34µs/call:
# 19 times (117µs+527µs) by Test::Deep::descend at line 297 of Test/Deep.pm, avg 34µs/call | ||||
| 24 | 19 | 5µs | my $self = shift; | ||
| 25 | |||||
| 26 | 19 | 20µs | 19 | 17µs | my $type = $self->type; # spent 17µs making 19 calls to Test::Deep::Cache::type, avg 921ns/call |
| 27 | |||||
| 28 | 19 | 61µs | 19 | 509µs | $self->{$type}->[-1]->add(@_); # spent 509µs making 19 calls to Test::Deep::Cache::Simple::add, avg 27µs/call |
| 29 | } | ||||
| 30 | |||||
| 31 | sub cmp | ||||
| 32 | # spent 810µs (206+605) within Test::Deep::Cache::cmp which was called 19 times, avg 43µs/call:
# 19 times (206µs+605µs) by Test::Deep::descend at line 287 of Test/Deep.pm, avg 43µs/call | ||||
| 33 | # go through all the caches to see if we know this one | ||||
| 34 | |||||
| 35 | 19 | 5µs | my $self = shift; | ||
| 36 | |||||
| 37 | 19 | 24µs | 19 | 23µs | my $type = $self->type; # spent 23µs making 19 calls to Test::Deep::Cache::type, avg 1µs/call |
| 38 | |||||
| 39 | 19 | 21µs | foreach my $cache (@{$self->{$type}}) | ||
| 40 | { | ||||
| 41 | 38 | 63µs | 38 | 582µs | return 1 if $cache->cmp(@_); # spent 582µs making 38 calls to Test::Deep::Cache::Simple::cmp, avg 15µs/call |
| 42 | } | ||||
| 43 | |||||
| 44 | 19 | 36µs | return 0 | ||
| 45 | } | ||||
| 46 | |||||
| 47 | sub local | ||||
| 48 | # spent 31µs (25+6) within Test::Deep::Cache::local which was called
# once (25µs+6µs) by Test::Deep::Cache::new at line 17 | ||||
| 49 | 1 | 600ns | my $self = shift; | ||
| 50 | |||||
| 51 | 1 | 7µs | foreach my $type (qw( expects normal )) | ||
| 52 | { | ||||
| 53 | 2 | 7µs | 2 | 6µs | push(@{$self->{$type}}, Test::Deep::Cache::Simple->new); # spent 6µs making 2 calls to Test::Deep::Cache::Simple::new, avg 3µs/call |
| 54 | } | ||||
| 55 | } | ||||
| 56 | |||||
| 57 | sub finish | ||||
| 58 | { | ||||
| 59 | my $self = shift; | ||||
| 60 | |||||
| 61 | my $keep = shift; | ||||
| 62 | |||||
| 63 | foreach my $type (qw( expects normal )) | ||||
| 64 | { | ||||
| 65 | my $caches = $self->{$type}; | ||||
| 66 | |||||
| 67 | my $last = pop @$caches; | ||||
| 68 | |||||
| 69 | $caches->[-1]->absorb($last) if $keep; | ||||
| 70 | } | ||||
| 71 | } | ||||
| 72 | |||||
| 73 | sub type | ||||
| 74 | { | ||||
| 75 | 38 | 75µs | return $Test::Deep::Expects ? "expects" : "normal"; | ||
| 76 | } | ||||
| 77 | |||||
| 78 | 1 | 2µs | 1; |