← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 17:10:45 2013
Reported on Tue Oct 15 17:12:20 2013

Filename/usr/lib/perl/5.10/Hash/Util.pm
StatementsExecuted 669 statements in 2.60ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
17111.13ms1.18msHash::Util::::lock_ref_keysHash::Util::lock_ref_keys
171193µs1.28msHash::Util::::lock_keysHash::Util::lock_keys
11135µs35µsHash::Util::::bootstrapHash::Util::bootstrap (xsub)
11128µs35µsHash::Util::::BEGIN@4Hash::Util::BEGIN@4
11113µs36µsHash::Util::::BEGIN@6Hash::Util::BEGIN@6
11112µs89µsHash::Util::::BEGIN@5Hash::Util::BEGIN@5
11111µs48µsHash::Util::::BEGIN@8Hash::Util::BEGIN@8
11111µs98µsHash::Util::::BEGIN@7Hash::Util::BEGIN@7
0000s0sHash::Util::::hash_seedHash::Util::hash_seed
0000s0sHash::Util::::hash_unlockedHash::Util::hash_unlocked
0000s0sHash::Util::::hashref_unlockedHash::Util::hashref_unlocked
0000s0sHash::Util::::hidden_keysHash::Util::hidden_keys
0000s0sHash::Util::::importHash::Util::import
0000s0sHash::Util::::legal_keysHash::Util::legal_keys
0000s0sHash::Util::::lock_hashHash::Util::lock_hash
0000s0sHash::Util::::lock_hash_recurseHash::Util::lock_hash_recurse
0000s0sHash::Util::::lock_hashrefHash::Util::lock_hashref
0000s0sHash::Util::::lock_hashref_recurseHash::Util::lock_hashref_recurse
0000s0sHash::Util::::lock_keys_plusHash::Util::lock_keys_plus
0000s0sHash::Util::::lock_ref_keys_plusHash::Util::lock_ref_keys_plus
0000s0sHash::Util::::lock_ref_valueHash::Util::lock_ref_value
0000s0sHash::Util::::lock_valueHash::Util::lock_value
0000s0sHash::Util::::unlock_hashHash::Util::unlock_hash
0000s0sHash::Util::::unlock_hash_recurseHash::Util::unlock_hash_recurse
0000s0sHash::Util::::unlock_hashrefHash::Util::unlock_hashref
0000s0sHash::Util::::unlock_hashref_recurseHash::Util::unlock_hashref_recurse
0000s0sHash::Util::::unlock_keysHash::Util::unlock_keys
0000s0sHash::Util::::unlock_ref_keysHash::Util::unlock_ref_keys
0000s0sHash::Util::::unlock_ref_valueHash::Util::unlock_ref_value
0000s0sHash::Util::::unlock_valueHash::Util::unlock_value
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Hash::Util;
2
3139µsrequire 5.007003;
4336µs242µs
# spent 35µs (28+7) within Hash::Util::BEGIN@4 which was called: # once (28µs+7µs) by fields::__ANON__[/usr/share/perl/5.10/fields.pm:128] at line 4
use strict;
# spent 35µs making 1 call to Hash::Util::BEGIN@4 # spent 7µs making 1 call to strict::import
5334µs2167µs
# spent 89µs (12+77) within Hash::Util::BEGIN@5 which was called: # once (12µs+77µs) by fields::__ANON__[/usr/share/perl/5.10/fields.pm:128] at line 5
use Carp;
# spent 89µs making 1 call to Hash::Util::BEGIN@5 # spent 77µs making 1 call to Exporter::import
6329µs259µs
# spent 36µs (13+23) within Hash::Util::BEGIN@6 which was called: # once (13µs+23µs) by fields::__ANON__[/usr/share/perl/5.10/fields.pm:128] at line 6
use warnings;
# spent 36µs making 1 call to Hash::Util::BEGIN@6 # spent 23µs making 1 call to warnings::import
7334µs2185µs
# spent 98µs (11+87) within Hash::Util::BEGIN@7 which was called: # once (11µs+87µs) by fields::__ANON__[/usr/share/perl/5.10/fields.pm:128] at line 7
use warnings::register;
# spent 98µs making 1 call to Hash::Util::BEGIN@7 # spent 87µs making 1 call to warnings::register::import
831.04ms286µs
# spent 48µs (11+37) within Hash::Util::BEGIN@8 which was called: # once (11µs+37µs) by fields::__ANON__[/usr/share/perl/5.10/fields.pm:128] at line 8
use Scalar::Util qw(reftype);
# spent 48µs making 1 call to Hash::Util::BEGIN@8 # spent 38µs making 1 call to Exporter::import
9
1011µsrequire Exporter;
11117µsour @ISA = qw(Exporter);
1216µsour @EXPORT_OK = qw(
13 fieldhash fieldhashes
14
15 all_keys
16 lock_keys unlock_keys
17 lock_value unlock_value
18 lock_hash unlock_hash
19 lock_keys_plus hash_locked
20 hidden_keys legal_keys
21
22 lock_ref_keys unlock_ref_keys
23 lock_ref_value unlock_ref_value
24 lock_hashref unlock_hashref
25 lock_ref_keys_plus hashref_locked
26 hidden_ref_keys legal_ref_keys
27
28 hash_seed hv_store
29
30 );
311400nsour $VERSION = 0.07;
321900nsrequire DynaLoader;
33113µslocal @ISA = qw(DynaLoader);
3419µs1337µsbootstrap Hash::Util $VERSION;
# spent 337µs making 1 call to DynaLoader::bootstrap
35
36sub import {
37 my $class = shift;
38 if ( grep /fieldhash/, @_ ) {
39 require Hash::Util::FieldHash;
40 Hash::Util::FieldHash->import(':all'); # for re-export
41 }
42 unshift @_, $class;
43 goto &Exporter::import;
44}
45
46
# spent 1.18ms (1.13+51µs) within Hash::Util::lock_ref_keys which was called 17 times, avg 70µs/call: # 17 times (1.13ms+51µs) by Hash::Util::lock_keys at line 81, avg 70µs/call
sub lock_ref_keys {
471757µs my($hash, @keys) = @_;
48
491785µs1726µs Internals::hv_clear_placeholders %$hash;
# spent 26µs making 17 calls to Internals::hv_clear_placeholders, avg 2µs/call
501720µs if( @keys ) {
5117182µs my %keys = map { ($_ => 1) } @keys;
521725µs my %original_keys = map { ($_ => 1) } keys %$hash;
531740µs foreach my $k (keys %original_keys) {
54 croak "Hash has key '$k' which is not in the new key set"
55 unless $keys{$k};
56 }
57
581718µs foreach my $k (@keys) {
59229319µs $hash->{$k} = undef unless exists $hash->{$k};
60 }
6117101µs1725µs Internals::SvREADONLY %$hash, 1;
# spent 25µs making 17 calls to Internals::SvREADONLY, avg 1µs/call
62
631746µs foreach my $k (@keys) {
64229245µs delete $hash->{$k} unless $original_keys{$k};
65 }
66 }
67 else {
68 Internals::SvREADONLY %$hash, 1;
69 }
70
711777µs return $hash;
72}
73
74sub unlock_ref_keys {
75 my $hash = shift;
76
77 Internals::SvREADONLY %$hash, 0;
78 return $hash;
79}
80
811782µs171.18ms
# spent 1.28ms (93µs+1.18) within Hash::Util::lock_keys which was called 17 times, avg 75µs/call: # 17 times (93µs+1.18ms) by fields::__ANON__[/usr/share/perl/5.10/fields.pm:128] at line 126 of fields.pm, avg 75µs/call
sub lock_keys (\%;@) { lock_ref_keys(@_) }
# spent 1.18ms making 17 calls to Hash::Util::lock_ref_keys, avg 70µs/call
82sub unlock_keys (\%) { unlock_ref_keys(@_) }
83
84sub lock_ref_keys_plus {
85 my ($hash,@keys)=@_;
86 my @delete;
87 Internals::hv_clear_placeholders(%$hash);
88 foreach my $key (@keys) {
89 unless (exists($hash->{$key})) {
90 $hash->{$key}=undef;
91 push @delete,$key;
92 }
93 }
94 Internals::SvREADONLY(%$hash,1);
95 delete @{$hash}{@delete};
96 return $hash
97}
98
99sub lock_keys_plus(\%;@) { lock_ref_keys_plus(@_) }
100
101sub lock_ref_value {
102 my($hash, $key) = @_;
103 # I'm doubtful about this warning, as it seems not to be true.
104 # Marking a value in the hash as RO is useful, regardless
105 # of the status of the hash itself.
106 carp "Cannot usefully lock values in an unlocked hash"
107 if !Internals::SvREADONLY(%$hash) && warnings::enabled;
108 Internals::SvREADONLY $hash->{$key}, 1;
109 return $hash
110}
111
112sub unlock_ref_value {
113 my($hash, $key) = @_;
114 Internals::SvREADONLY $hash->{$key}, 0;
115 return $hash
116}
117
118sub lock_value (\%$) { lock_ref_value(@_) }
119sub unlock_value (\%$) { unlock_ref_value(@_) }
120
121sub lock_hashref {
122 my $hash = shift;
123
124 lock_ref_keys($hash);
125
126 foreach my $value (values %$hash) {
127 Internals::SvREADONLY($value,1);
128 }
129
130 return $hash;
131}
132
133sub unlock_hashref {
134 my $hash = shift;
135
136 foreach my $value (values %$hash) {
137 Internals::SvREADONLY($value, 0);
138 }
139
140 unlock_ref_keys($hash);
141
142 return $hash;
143}
144
145sub lock_hash (\%) { lock_hashref(@_) }
146sub unlock_hash (\%) { unlock_hashref(@_) }
147
148sub lock_hashref_recurse {
149 my $hash = shift;
150
151 lock_ref_keys($hash);
152 foreach my $value (values %$hash) {
153 if (reftype($value) eq 'HASH') {
154 lock_hashref_recurse($value);
155 }
156 Internals::SvREADONLY($value,1);
157 }
158 return $hash
159}
160
161sub unlock_hashref_recurse {
162 my $hash = shift;
163
164 foreach my $value (values %$hash) {
165 if (reftype($value) eq 'HASH') {
166 unlock_hashref_recurse($value);
167 }
168 Internals::SvREADONLY($value,1);
169 }
170 unlock_ref_keys($hash);
171 return $hash;
172}
173
174sub lock_hash_recurse (\%) { lock_hashref_recurse(@_) }
175sub unlock_hash_recurse (\%) { unlock_hashref_recurse(@_) }
176
177sub hashref_unlocked {
178 my $hash=shift;
179 return Internals::SvREADONLY($hash)
180}
181
182sub hash_unlocked(\%) { hashref_unlocked(@_) }
183
184sub legal_keys(\%) { legal_ref_keys(@_) }
185sub hidden_keys(\%){ hidden_ref_keys(@_) }
186
187sub hash_seed () {
188 Internals::rehash_seed();
189}
190
191147µs1;
 
# spent 35µs within Hash::Util::bootstrap which was called: # once (35µs+0s) by DynaLoader::bootstrap at line 215 of DynaLoader.pm
sub Hash::Util::bootstrap; # xsub