← 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 11:58:52 2013
Reported on Tue Oct 15 12:01:04 2013

Filename/usr/share/perl5/Date/Manip/Obj.pm
StatementsExecuted 278 statements in 3.38ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11120.5ms21.6msDate::Manip::Obj::::BEGIN@16Date::Manip::Obj::BEGIN@16
11115.8ms16.7msDate::Manip::Obj::::BEGIN@15Date::Manip::Obj::BEGIN@15
11110.7ms11.4msDate::Manip::Obj::::new_recurDate::Manip::Obj::new_recur
1115.42ms6.07msDate::Manip::Obj::::new_deltaDate::Manip::Obj::new_delta
972824µs19.6msDate::Manip::Obj::::newDate::Manip::Obj::new (recurses: max depth 1, inclusive time 18.8ms)
272162µs62µsDate::Manip::Obj::::CORE:matchDate::Manip::Obj::CORE:match (opcode)
272160µs60µsDate::Manip::Obj::::CORE:regcompDate::Manip::Obj::CORE:regcomp (opcode)
11126µs1.62msDate::Manip::Obj::::configDate::Manip::Obj::config
71126µs26µsDate::Manip::Obj::::_init_finalDate::Manip::Obj::_init_final
11120µs103µsDate::Manip::Obj::::BEGIN@13Date::Manip::Obj::BEGIN@13
11118µs69µsDate::Manip::Obj::::BEGIN@18Date::Manip::Obj::BEGIN@18
11117µs31µsDate::Manip::Obj::::BEGIN@10Date::Manip::Obj::BEGIN@10
11116µs84µsDate::Manip::Obj::::BEGIN@9Date::Manip::Obj::BEGIN@9
11113µs69µsDate::Manip::Obj::::new_dateDate::Manip::Obj::new_date
22112µs12µsDate::Manip::Obj::::CORE:qrDate::Manip::Obj::CORE:qr (opcode)
11111µs204µsDate::Manip::Obj::::BEGIN@12Date::Manip::Obj::BEGIN@12
11111µs14µsDate::Manip::Obj::::BEGIN@11Date::Manip::Obj::BEGIN@11
1116µs6µsDate::Manip::Obj::::tzDate::Manip::Obj::tz
1116µs6µsDate::Manip::Obj::::baseDate::Manip::Obj::base
0000s0sDate::Manip::Obj::::_init_argsDate::Manip::Obj::_init_args
0000s0sDate::Manip::Obj::::errDate::Manip::Obj::err
0000s0sDate::Manip::Obj::::is_dateDate::Manip::Obj::is_date
0000s0sDate::Manip::Obj::::is_deltaDate::Manip::Obj::is_delta
0000s0sDate::Manip::Obj::::is_recurDate::Manip::Obj::is_recur
0000s0sDate::Manip::Obj::::new_configDate::Manip::Obj::new_config
0000s0sDate::Manip::Obj::::versionDate::Manip::Obj::version
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
0184µsProfile data that couldn't be associated with a specific line:
# spent 84µs making 1 call to Date::Manip::Obj::BEGIN@9
118µspackage Date::Manip::Obj;
2# Copyright (c) 2008-2010 Sullivan Beck. All rights reserved.
3# This program is free software; you can redistribute it and/or modify it
4# under the same terms as Perl itself.
5
6########################################################################
7########################################################################
8
9492µs168µs
# spent 84µs (16+68) within Date::Manip::Obj::BEGIN@9 which was called: # once (16µs+68µs) by Date::Manip::Date::BEGIN@14 at line 0
require 5.010000;
# spent 68µs making 1 call to feature::import
10330µs244µs
# spent 31µs (17+14) within Date::Manip::Obj::BEGIN@10 which was called: # once (17µs+14µs) by Date::Manip::Date::BEGIN@14 at line 10
use warnings;
# spent 31µs making 1 call to Date::Manip::Obj::BEGIN@10 # spent 14µs making 1 call to warnings::import
11330µs217µs
# spent 14µs (11+3) within Date::Manip::Obj::BEGIN@11 which was called: # once (11µs+3µs) by Date::Manip::Date::BEGIN@14 at line 11
use strict;
# spent 14µs making 1 call to Date::Manip::Obj::BEGIN@11 # spent 3µs making 1 call to strict::import
12336µs2397µs
# spent 204µs (11+193) within Date::Manip::Obj::BEGIN@12 which was called: # once (11µs+193µs) by Date::Manip::Date::BEGIN@14 at line 12
use IO::File;
# spent 204µs making 1 call to Date::Manip::Obj::BEGIN@12 # spent 193µs making 1 call to Exporter::import
13339µs2187µs
# spent 103µs (20+84) within Date::Manip::Obj::BEGIN@13 which was called: # once (20µs+84µs) by Date::Manip::Date::BEGIN@14 at line 13
use Storable qw(dclone);
# spent 103µs making 1 call to Date::Manip::Obj::BEGIN@13 # spent 84µs making 1 call to Exporter::import
14
153140µs116.7ms
# spent 16.7ms (15.8+968µs) within Date::Manip::Obj::BEGIN@15 which was called: # once (15.8ms+968µs) by Date::Manip::Date::BEGIN@14 at line 15
use Date::Manip::Base;
# spent 16.7ms making 1 call to Date::Manip::Obj::BEGIN@15
163293µs121.6ms
# spent 21.6ms (20.5+1.06) within Date::Manip::Obj::BEGIN@16 which was called: # once (20.5ms+1.06ms) by Date::Manip::Date::BEGIN@14 at line 16
use Date::Manip::TZ;
# spent 21.6ms making 1 call to Date::Manip::Obj::BEGIN@16
17
1831.29ms2120µs
# spent 69µs (18+51) within Date::Manip::Obj::BEGIN@18 which was called: # once (18µs+51µs) by Date::Manip::Date::BEGIN@14 at line 18
use vars qw($VERSION);
# spent 69µs making 1 call to Date::Manip::Obj::BEGIN@18 # spent 51µs making 1 call to vars::import
191800ns$VERSION='6.11';
20
21########################################################################
22# METHODS
23########################################################################
24
25117µs110µsmy $dmo_rx = qr/^Date::Manip::(Base|TZ|Date|Delta|Recur)$/;
# spent 10µs making 1 call to Date::Manip::Obj::CORE:qr
2615µs12µsmy $dmh_rx = qr/^Date::Manip::(Date|Delta|Recur)$/;
# spent 2µs making 1 call to Date::Manip::Obj::CORE:qr
27
28
# spent 19.6ms (824µs+18.7) within Date::Manip::Obj::new which was called 9 times, avg 2.17ms/call: # 2 times (174µs+-174µs) by Date::Manip::Obj::new at line 104, avg 0s/call # 2 times (113µs+-113µs) by Date::Manip::Obj::new at line 103, avg 0s/call # once (229µs+12.4ms) by C4::Overdues::BEGIN@25 at line 66 of Date/Manip.pm # once (97µs+6.53ms) by C4::Overdues::BEGIN@25 at line 69 of Date/Manip.pm # once (80µs+81µs) by Date::Manip::Obj::new_recur at line 238 # once (92µs+34µs) by Date::Manip::Obj::new_delta at line 233 # once (39µs+17µs) by Date::Manip::Obj::new_date at line 228
sub new {
29216926µs my(@args) = @_;
30 my(@allargs) = @args;
31
32 # Get the object or class.
33
34 my($self,$class);
35
363699µs if (ref($args[0]) =~ $dmo_rx) {
# spent 53µs making 18 calls to Date::Manip::Obj::CORE:match, avg 3µs/call # spent 47µs making 18 calls to Date::Manip::Obj::CORE:regcomp, avg 3µs/call
37 $self = shift(@args);
38 $class = ref($args[0]);
39
40 } elsif ($args[0] =~ $dmo_rx) {
41 $class = shift(@args);
42
43 } else {
44 warn "ERROR: [new] first argument must be a Date::Manip class/object\n";
45 return undef;
46 }
47
48 # Get an existing Date::Manip::* object, if any
49
50 my $obj;
511822µs if ($self) {
# spent 13µs making 9 calls to Date::Manip::Obj::CORE:regcomp, avg 1µs/call # spent 9µs making 9 calls to Date::Manip::Obj::CORE:match, avg 1µs/call
52 $obj = $self;
53 } elsif (ref($args[0]) =~ $dmo_rx) {
54 $obj = shift(@args);
55 }
56
57 # Find out if there are any config options (which will be the
58 # final argument).
59
60 my @config;
61 if (@args && ref($args[$#args]) eq 'ARRAY') {
62 @config = @{ pop(@args) };
63 }
64
65 # Any other arguments at this point are passed to _init.
66
67 # Get Base/TZ objects from an existing object
68
69 my($dmt,$dmb);
70
71 if ($obj) {
72 $dmb = $$obj{'objs'}{'base'} if (exists $$obj{'objs'}{'base'});
73 $dmt = $$obj{'objs'}{'tz'} if (exists $$obj{'objs'}{'tz'});
74 }
75
76 # Create a new empty object.
77
78 my $new = {
79 'objs' => {},
80 'data' => {},
81 'args' => [ @args ],
82 'err' => '',
83 };
84
85 # Create new Base/TZ objects if necessary
86
87 my $init = 1;
88 if (! $dmb) {
89
90 # We're creating first-time instances:
91 # $dmb = new Date::Manip::Base [,\@config];
92 # $dmt = new Date::Manip::TZ [,\@config];
93 # $obj = new Date::Manip::* [,\@config];
94
95 if ($class eq 'Date::Manip::Base') {
96 $dmb = $new;
97
98 } elsif ($class eq 'Date::Manip::TZ') {
99 $dmb = new Date::Manip::Base;
100 $dmt = $new;
101
102 } else {
10320s $dmb = new Date::Manip::Base;
# spent 17.5ms making 2 calls to Date::Manip::Obj::new, avg 8.76ms/call, recursion: max depth 1, sum of overlapping time 17.5ms
10420s $dmt = new Date::Manip::TZ $dmb;
# spent 1.28ms making 2 calls to Date::Manip::Obj::new, avg 640µs/call, recursion: max depth 1, sum of overlapping time 1.28ms
105 }
106
107 } elsif ($class eq 'Date::Manip::Base') {
108
109 # $dmb = new Date::Manip::Base $obj [,\@config];
110 # This should create a new instance of a Base object
111 # with the same configuration.
112
113 $new = dclone($dmb);
114 $$new{'cache'} = $$dmb{'cache'};
115 $dmb = $new;
116 $init = 0;
117
118 } elsif (@config && $class eq 'Date::Manip::TZ') {
119
120 # $dmt = new Date::Manip::TZ $obj,\@config;
121
122 $dmb = new Date::Manip::Base $obj,[@config];
123 $dmt = $new;
124
125 } elsif (@config) {
126
127 # $obj2 = new Date::Manip::* $obj1,\@config;
128
129 $dmb = new Date::Manip::Base $obj,\@config;
130 $dmt = new Date::Manip::TZ $dmb;
131
132 } elsif ($class eq 'Date::Manip::TZ') {
133
134 # $dmt = new Date::Manip::TZ $obj;
135 # Reuse $dmb object
136
137 $dmt = $new;
138
139 } else {
140
141 # $obj2 = new Date::Manip::* $boj1;
142 # Use existing $dmb/$dmt
143
144 }
145
146 bless $new,$class;
147
148 $$new{'objs'}{'base'} = $dmb;
149 $$new{'objs'}{'tz'} = $dmt if ($dmt);
150 $$dmb{'objs'}{'tz'} = $dmt if ($dmt);
151
152917.7ms $new->_init() unless (! $init);
# spent 17.4ms making 2 calls to Date::Manip::Base::_init, avg 8.69ms/call # spent 170µs making 2 calls to Date::Manip::TZ::_init, avg 85µs/call # spent 66µs making 1 call to Date::Manip::Recur::_init # spent 53µs making 3 calls to Date::Manip::Date::_init, avg 18µs/call # spent 13µs making 1 call to Date::Manip::Delta::_init
153
154 # Apply configuration options and parse the string.
155
156 if (@config) {
157 $dmb->config(@config);
158 }
159
160 $new->_init_args() if (@args);
1619928µs $new->_init_final();
# spent 902µs making 2 calls to Date::Manip::TZ::_init_final, avg 451µs/call # spent 26µs making 7 calls to Date::Manip::Obj::_init_final, avg 4µs/call
162
163 return $new;
164}
165
166sub _init_args {
167 my($self) = @_;
168
169 my @args = @{ $$self{'args'} };
170 if (@args) {
171 warn "WARNING: [new] invalid arguments: @args\n";
172 }
173}
174
175
# spent 26µs within Date::Manip::Obj::_init_final which was called 7 times, avg 4µs/call: # 7 times (26µs+0s) by Date::Manip::Obj::new at line 161, avg 4µs/call
sub _init_final {
1761436µs my($self) = @_;
177 return;
178}
179
180sub new_config {
181 my(@args) = @_;
182
183 # Make sure that @opts is passed in as the final argument.
184
185 if (! @args ||
186 ! (ref($args[$#args]) eq 'ARRAY')) {
187 push(@args,['ignore','ignore']);
188 }
189
190 return new(@args);
191}
192
193
# spent 6µs within Date::Manip::Obj::base which was called: # once (6µs+0s) by C4::Overdues::BEGIN@25 at line 73 of Date/Manip.pm
sub base {
19427µs my($self) = @_;
195 return $$self{'objs'}{'base'};
196}
197
198
# spent 6µs within Date::Manip::Obj::tz which was called: # once (6µs+0s) by C4::Overdues::BEGIN@25 at line 74 of Date/Manip.pm
sub tz {
19927µs my($self) = @_;
200 return $$self{'objs'}{'tz'} if (exists $$self{'objs'}{'tz'});
201 return undef;
202}
203
204
# spent 1.62ms (26µs+1.59) within Date::Manip::Obj::config which was called: # once (26µs+1.59ms) by C4::Overdues::BEGIN@25 at line 67 of Date/Manip.pm
sub config {
205645µs my($self,@config) = @_;
206 my $dmb = $$self{'objs'}{'base'};
207
208 while (@config) {
209 my $var = shift(@config);
210 my $val = shift(@config);
21111.59ms $dmb->_config_var($var,$val);
# spent 1.59ms making 1 call to Date::Manip::Base::_config_var
212 }
213}
214
215sub err {
216 my($self,$arg) = @_;
217 if ($arg) {
218 $$self{'err'} = '';
219 return;
220 } else {
221 return $$self{'err'};
222 }
223}
224
225
# spent 69µs (13+56) within Date::Manip::Obj::new_date which was called: # once (13µs+56µs) by C4::Overdues::BEGIN@25 at line 70 of Date/Manip.pm
sub new_date {
226313µs my(@args) = @_;
227 require Date::Manip::Date;
228156µs return new Date::Manip::Date @args;
# spent 56µs making 1 call to Date::Manip::Obj::new
229}
230
# spent 6.07ms (5.42+645µs) within Date::Manip::Obj::new_delta which was called: # once (5.42ms+645µs) by C4::Overdues::BEGIN@25 at line 71 of Date/Manip.pm
sub new_delta {
2313200µs my(@args) = @_;
232 require Date::Manip::Delta;
2331127µs return new Date::Manip::Delta @args;
# spent 127µs making 1 call to Date::Manip::Obj::new
234}
235
# spent 11.4ms (10.7+720µs) within Date::Manip::Obj::new_recur which was called: # once (10.7ms+720µs) by C4::Overdues::BEGIN@25 at line 72 of Date/Manip.pm
sub new_recur {
2363149µs my(@args) = @_;
237 require Date::Manip::Recur;
2381160µs return new Date::Manip::Recur @args;
# spent 160µs making 1 call to Date::Manip::Obj::new
239}
240
241sub is_date {
242 return 0;
243}
244sub is_delta {
245 return 0;
246}
247sub is_recur {
248 return 0;
249}
250
251sub version {
252 my($self,$flag) = @_;
253 if ($flag && ref($self) ne "Date::Manip::Base") {
254 my $dmb = $$self{'objs'}{'base'};
255 my ($tz) = $dmb->_now("systz");
256 return "$VERSION [$tz]";
257 } else {
258 return $VERSION;
259 }
260}
261
262121µs1;
263# Local Variables:
264# mode: cperl
265# indent-tabs-mode: nil
266# cperl-indent-level: 3
267# cperl-continued-statement-offset: 2
268# cperl-continued-brace-offset: 0
269# cperl-brace-offset: 0
270# cperl-brace-imaginary-offset: 0
271# cperl-label-offset: -2
272# End:
 
# spent 62µs within Date::Manip::Obj::CORE:match which was called 27 times, avg 2µs/call: # 18 times (53µs+0s) by Date::Manip::Obj::new at line 36, avg 3µs/call # 9 times (9µs+0s) by Date::Manip::Obj::new at line 51, avg 1µs/call
sub Date::Manip::Obj::CORE:match; # opcode
# spent 12µs within Date::Manip::Obj::CORE:qr which was called 2 times, avg 6µs/call: # once (10µs+0s) by Date::Manip::Date::BEGIN@14 at line 25 # once (2µs+0s) by Date::Manip::Date::BEGIN@14 at line 26
sub Date::Manip::Obj::CORE:qr; # opcode
# spent 60µs within Date::Manip::Obj::CORE:regcomp which was called 27 times, avg 2µs/call: # 18 times (47µs+0s) by Date::Manip::Obj::new at line 36, avg 3µs/call # 9 times (13µs+0s) by Date::Manip::Obj::new at line 51, avg 1µs/call
sub Date::Manip::Obj::CORE:regcomp; # opcode