File | /usr/local/lib/perl5/5.10.1/Test/Deep/HashElements.pm |
Statements Executed | 82 |
Statement Execution Time | 524µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
2 | 1 | 1 | 76µs | 3.92ms | descend | Test::Deep::HashElements::
3 | 3 | 3 | 57µs | 68µs | BEGIN@1 | Test::Deep::Hash::
3 | 3 | 3 | 45µs | 79µs | BEGIN@2 | Test::Deep::Hash::
1 | 1 | 1 | 9µs | 86µs | BEGIN@70 | Test::Deep::SuperHashElements::
1 | 1 | 1 | 9µs | 54µs | BEGIN@83 | Test::Deep::SubHashElements::
1 | 1 | 1 | 8µs | 33µs | BEGIN@6 | Test::Deep::HashElements::
2 | 1 | 1 | 5µs | 5µs | getMaster | Test::Deep::HashElements::
2 | 1 | 1 | 4µs | 4µs | init | Test::Deep::HashElements::
0 | 0 | 0 | 0s | 0s | render_stack | Test::Deep::HashElements::
0 | 0 | 0 | 0s | 0s | reset_arrow | Test::Deep::HashElements::
0 | 0 | 0 | 0s | 0s | getMaster | Test::Deep::SubHashElements::
0 | 0 | 0 | 0s | 0s | getMaster | Test::Deep::SuperHashElements::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 3 | 27µs | 2 | 28µs | # spent 68µs (57+11) within Test::Deep::Hash::BEGIN@1 which was called 3 times, avg 23µs/call:
# once (21µs+3µs) by Test::Deep::Hash::hash_elements at line 1
# once (18µs+4µs) by Test::Deep::Hash::hash_keys at line 1 of Test/Deep/HashKeys.pm
# once (18µs+4µs) by Test::Deep::Hash::BEGIN@6 at line 1 of Test/Deep/Ref.pm # spent 24µs making 1 call to Test::Deep::Hash::BEGIN@1
# spent 3µs making 1 call to strict::import |
2 | 3 | 30µs | 2 | 30µs | # spent 79µs (45+34) within Test::Deep::Hash::BEGIN@2 which was called 3 times, avg 26µs/call:
# once (27µs+12µs) by Test::Deep::Hash::hash_keys at line 2 of Test/Deep/HashKeys.pm
# once (10µs+11µs) by Test::Deep::Hash::BEGIN@6 at line 2 of Test/Deep/Ref.pm
# once (8µs+11µs) by Test::Deep::Hash::hash_elements at line 2 # spent 19µs making 1 call to Test::Deep::Hash::BEGIN@2
# spent 11µs making 1 call to warnings::import |
3 | |||||
4 | package Test::Deep::HashElements; | ||||
5 | |||||
6 | 3 | 258µs | 2 | 57µs | # spent 33µs (8+25) within Test::Deep::HashElements::BEGIN@6 which was called
# once (8µs+25µs) by Test::Deep::Hash::hash_elements at line 6 # spent 33µs making 1 call to Test::Deep::HashElements::BEGIN@6
# spent 25µs making 1 call to Test::Deep::Cmp::import |
7 | |||||
8 | sub init | ||||
9 | # spent 4µs within Test::Deep::HashElements::init which was called 2 times, avg 2µs/call:
# 2 times (4µs+0s) by Test::Deep::Cmp::new at line 32 of Test/Deep/Cmp.pm, avg 2µs/call | ||||
10 | 6 | 8µs | my $self = shift; | ||
11 | |||||
12 | my $val = shift; | ||||
13 | |||||
14 | $self->{val} = $val; | ||||
15 | } | ||||
16 | |||||
17 | sub descend | ||||
18 | # spent 3.92ms (76µs+3.85) within Test::Deep::HashElements::descend which was called 2 times, avg 1.96ms/call:
# 2 times (76µs+3.85ms) by Test::Deep::descend at line 312 of Test/Deep.pm, avg 1.96ms/call | ||||
19 | 54 | 50µs | my $self = shift; | ||
20 | |||||
21 | my $got = shift; | ||||
22 | |||||
23 | my $exp = $self->{val}; | ||||
24 | |||||
25 | my $data = $self->data; # spent 13µs making 2 calls to Test::Deep::Cmp::data, avg 7µs/call | ||||
26 | |||||
27 | my $master = $self->getMaster($got, $exp); # spent 5µs making 2 calls to Test::Deep::HashElements::getMaster, avg 3µs/call | ||||
28 | |||||
29 | foreach my $key (keys %$master) | ||||
30 | { | ||||
31 | $data->{index} = $key; | ||||
32 | |||||
33 | my $got_elem = exists $got->{$key} ? $got->{$key} : $Test::Deep::DNE; | ||||
34 | my $exp_elem = exists $exp->{$key} ? $exp->{$key} : $Test::Deep::DNE; | ||||
35 | |||||
36 | next if Test::Deep::descend($got_elem, $exp_elem); # spent 3.89ms making 10 calls to Test::Deep::descend, avg 389µs/call, recursion: max depth 4, time 3.89ms | ||||
37 | |||||
38 | return 0; | ||||
39 | } | ||||
40 | |||||
41 | return 1; | ||||
42 | } | ||||
43 | |||||
44 | sub getMaster | ||||
45 | # spent 5µs within Test::Deep::HashElements::getMaster which was called 2 times, avg 3µs/call:
# 2 times (5µs+0s) by Test::Deep::HashElements::descend at line 27, avg 3µs/call | ||||
46 | 6 | 8µs | my $self = shift; | ||
47 | |||||
48 | my ($got, $exp) = @_; | ||||
49 | |||||
50 | return keys %$got > keys %$exp ? $got : $exp; | ||||
51 | } | ||||
52 | |||||
53 | sub render_stack | ||||
54 | { | ||||
55 | my $self = shift; | ||||
56 | my ($var, $data) = @_; | ||||
57 | $var .= "->" unless $Test::Deep::Stack->incArrow; | ||||
58 | $var .= '{"'.quotemeta($data->{index}).'"}'; | ||||
59 | |||||
60 | return $var; | ||||
61 | } | ||||
62 | |||||
63 | sub reset_arrow | ||||
64 | { | ||||
65 | return 0; | ||||
66 | } | ||||
67 | |||||
68 | package Test::Deep::SuperHashElements; | ||||
69 | |||||
70 | 3 | 71µs | 2 | 162µs | # spent 86µs (9+77) within Test::Deep::SuperHashElements::BEGIN@70 which was called
# once (9µs+77µs) by Test::Deep::Hash::hash_elements at line 70 # spent 86µs making 1 call to Test::Deep::SuperHashElements::BEGIN@70
# spent 77µs making 1 call to base::import |
71 | |||||
72 | sub getMaster | ||||
73 | { | ||||
74 | my $self = shift; | ||||
75 | |||||
76 | my ($got, $exp) = @_; | ||||
77 | |||||
78 | return $exp; | ||||
79 | } | ||||
80 | |||||
81 | package Test::Deep::SubHashElements; | ||||
82 | |||||
83 | 3 | 70µs | 2 | 100µs | # spent 54µs (9+45) within Test::Deep::SubHashElements::BEGIN@83 which was called
# once (9µs+45µs) by Test::Deep::Hash::hash_elements at line 83 # spent 54µs making 1 call to Test::Deep::SubHashElements::BEGIN@83
# spent 45µs making 1 call to base::import |
84 | |||||
85 | sub getMaster | ||||
86 | { | ||||
87 | my $self = shift; | ||||
88 | |||||
89 | my ($got, $exp) = @_; | ||||
90 | |||||
91 | return $got; | ||||
92 | } | ||||
93 | |||||
94 | 1 | 3µs | 1; |