Filename | /home/ss5/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/Test/Deep/HashElements.pm |
Statements | Executed 62 statements in 2.30ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
3 | 1 | 1 | 244µs | 422µs | descend | Test::Deep::HashElements::
1 | 1 | 1 | 66µs | 83µs | BEGIN@1.23 | Test::Deep::Hash::
3 | 1 | 1 | 44µs | 44µs | init | Test::Deep::HashElements::
1 | 1 | 1 | 43µs | 119µs | BEGIN@6 | Test::Deep::HashElements::
3 | 1 | 1 | 39µs | 39µs | getMaster | Test::Deep::HashElements::
1 | 1 | 1 | 36µs | 353µs | BEGIN@70 | Test::Deep::SuperHashElements::
1 | 1 | 1 | 33µs | 62µs | BEGIN@2.24 | Test::Deep::Hash::
1 | 1 | 1 | 29µs | 288µs | BEGIN@83 | Test::Deep::SubHashElements::
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 | 2 | 113µs | 2 | 101µs | # spent 83µs (66+17) within Test::Deep::Hash::BEGIN@1.23 which was called:
# once (66µs+17µs) by Test::Deep::Hash::hash_elements at line 1 # spent 83µs making 1 call to Test::Deep::Hash::BEGIN@1.23
# spent 17µs making 1 call to strict::import |
2 | 2 | 126µs | 2 | 90µs | # spent 62µs (33+28) within Test::Deep::Hash::BEGIN@2.24 which was called:
# once (33µs+28µs) by Test::Deep::Hash::hash_elements at line 2 # spent 62µs making 1 call to Test::Deep::Hash::BEGIN@2.24
# spent 28µs making 1 call to warnings::import |
3 | |||||
4 | package Test::Deep::HashElements; | ||||
5 | |||||
6 | 2 | 1.24ms | 2 | 195µs | # spent 119µs (43+76) within Test::Deep::HashElements::BEGIN@6 which was called:
# once (43µs+76µs) by Test::Deep::Hash::hash_elements at line 6 # spent 119µs making 1 call to Test::Deep::HashElements::BEGIN@6
# spent 76µs making 1 call to Test::Deep::Cmp::import |
7 | |||||
8 | sub init | ||||
9 | # spent 44µs within Test::Deep::HashElements::init which was called 3 times, avg 15µs/call:
# 3 times (44µs+0s) by Test::Deep::Cmp::new at line 33 of Test/Deep/Cmp.pm, avg 15µs/call | ||||
10 | 9 | 70µs | my $self = shift; | ||
11 | |||||
12 | my $val = shift; | ||||
13 | |||||
14 | $self->{val} = $val; | ||||
15 | } | ||||
16 | |||||
17 | sub descend | ||||
18 | # spent 422µs (244+178) within Test::Deep::HashElements::descend which was called 3 times, avg 141µs/call:
# 3 times (244µs+178µs) by Test::Deep::descend at line 328 of Test/Deep.pm, avg 141µs/call | ||||
19 | 33 | 206µs | my $self = shift; | ||
20 | |||||
21 | my $got = shift; | ||||
22 | |||||
23 | my $exp = $self->{val}; | ||||
24 | |||||
25 | 3 | 101µs | my $data = $self->data; # spent 101µs making 3 calls to Test::Deep::Cmp::data, avg 34µs/call | ||
26 | |||||
27 | 3 | 39µs | my $master = $self->getMaster($got, $exp); # spent 39µs making 3 calls to Test::Deep::HashElements::getMaster, avg 13µ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 | 3 | 0s | next if Test::Deep::descend($got_elem, $exp_elem); # spent 38µs making 3 calls to Test::Deep::descend, avg 13µs/call, recursion: max depth 2, sum of overlapping time 38µs | ||
37 | |||||
38 | return 0; | ||||
39 | } | ||||
40 | |||||
41 | return 1; | ||||
42 | } | ||||
43 | |||||
44 | sub getMaster | ||||
45 | # spent 39µs within Test::Deep::HashElements::getMaster which was called 3 times, avg 13µs/call:
# 3 times (39µs+0s) by Test::Deep::HashElements::descend at line 27, avg 13µs/call | ||||
46 | 9 | 56µ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 | 2 | 267µs | 2 | 670µs | # spent 353µs (36+317) within Test::Deep::SuperHashElements::BEGIN@70 which was called:
# once (36µs+317µs) by Test::Deep::Hash::hash_elements at line 70 # spent 353µs making 1 call to Test::Deep::SuperHashElements::BEGIN@70
# spent 317µ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 | 2 | 218µs | 2 | 548µs | # spent 288µs (29+259) within Test::Deep::SubHashElements::BEGIN@83 which was called:
# once (29µs+259µs) by Test::Deep::Hash::hash_elements at line 83 # spent 288µs making 1 call to Test::Deep::SubHashElements::BEGIN@83
# spent 259µ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 | 8µs | 1; |