| Filename | /usr/share/perl5/Date/Manip/Obj.pm |
| Statements | Executed 278 statements in 3.17ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 22.3ms | 23.3ms | Date::Manip::Obj::BEGIN@16 |
| 1 | 1 | 1 | 17.9ms | 18.9ms | Date::Manip::Obj::BEGIN@15 |
| 1 | 1 | 1 | 16.3ms | 17.1ms | Date::Manip::Obj::new_recur |
| 1 | 1 | 1 | 5.08ms | 5.82ms | Date::Manip::Obj::new_delta |
| 9 | 7 | 2 | 765µs | 17.7ms | Date::Manip::Obj::new (recurses: max depth 1, inclusive time 17.0ms) |
| 27 | 2 | 1 | 63µs | 63µs | Date::Manip::Obj::CORE:match (opcode) |
| 27 | 2 | 1 | 58µs | 58µs | Date::Manip::Obj::CORE:regcomp (opcode) |
| 1 | 1 | 1 | 30µs | 54µs | Date::Manip::Obj::BEGIN@10 |
| 1 | 1 | 1 | 25µs | 190µs | Date::Manip::Obj::BEGIN@13 |
| 7 | 1 | 1 | 22µs | 22µs | Date::Manip::Obj::_init_final |
| 1 | 1 | 1 | 22µs | 107µs | Date::Manip::Obj::BEGIN@18 |
| 1 | 1 | 1 | 19µs | 1.44ms | Date::Manip::Obj::config |
| 1 | 1 | 1 | 15µs | 20µs | Date::Manip::Obj::BEGIN@11 |
| 1 | 1 | 1 | 14µs | 238µs | Date::Manip::Obj::BEGIN@12 |
| 1 | 1 | 1 | 13µs | 72µs | Date::Manip::Obj::new_date |
| 1 | 1 | 1 | 12µs | 70µs | Date::Manip::Obj::BEGIN@9 |
| 2 | 2 | 1 | 10µs | 10µs | Date::Manip::Obj::CORE:qr (opcode) |
| 1 | 1 | 1 | 10µs | 10µs | Date::Manip::Obj::tz |
| 1 | 1 | 1 | 8µs | 8µs | Date::Manip::Obj::base |
| 0 | 0 | 0 | 0s | 0s | Date::Manip::Obj::_init_args |
| 0 | 0 | 0 | 0s | 0s | Date::Manip::Obj::err |
| 0 | 0 | 0 | 0s | 0s | Date::Manip::Obj::is_date |
| 0 | 0 | 0 | 0s | 0s | Date::Manip::Obj::is_delta |
| 0 | 0 | 0 | 0s | 0s | Date::Manip::Obj::is_recur |
| 0 | 0 | 0 | 0s | 0s | Date::Manip::Obj::new_config |
| 0 | 0 | 0 | 0s | 0s | Date::Manip::Obj::version |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 0 | 1 | 70µs | Profile data that couldn't be associated with a specific line: # spent 70µs making 1 call to Date::Manip::Obj::BEGIN@9 | ||
| 1 | 1 | 7µs | package 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 | |||||
| 9 | 4 | 66µs | 1 | 58µs | # spent 70µs (12+58) within Date::Manip::Obj::BEGIN@9 which was called:
# once (12µs+58µs) by Date::Manip::Date::BEGIN@14 at line 0 # spent 58µs making 1 call to feature::import |
| 10 | 3 | 57µs | 2 | 79µs | # spent 54µs (30+24) within Date::Manip::Obj::BEGIN@10 which was called:
# once (30µs+24µs) by Date::Manip::Date::BEGIN@14 at line 10 # spent 54µs making 1 call to Date::Manip::Obj::BEGIN@10
# spent 24µs making 1 call to warnings::import |
| 11 | 3 | 30µs | 2 | 24µs | # spent 20µs (15+5) within Date::Manip::Obj::BEGIN@11 which was called:
# once (15µs+5µs) by Date::Manip::Date::BEGIN@14 at line 11 # spent 20µs making 1 call to Date::Manip::Obj::BEGIN@11
# spent 5µs making 1 call to strict::import |
| 12 | 3 | 49µs | 2 | 462µs | # spent 238µs (14+224) within Date::Manip::Obj::BEGIN@12 which was called:
# once (14µs+224µs) by Date::Manip::Date::BEGIN@14 at line 12 # spent 238µs making 1 call to Date::Manip::Obj::BEGIN@12
# spent 224µs making 1 call to Exporter::import |
| 13 | 3 | 76µs | 2 | 356µs | # spent 190µs (25+166) within Date::Manip::Obj::BEGIN@13 which was called:
# once (25µs+166µs) by Date::Manip::Date::BEGIN@14 at line 13 # spent 190µs making 1 call to Date::Manip::Obj::BEGIN@13
# spent 166µs making 1 call to Exporter::import |
| 14 | |||||
| 15 | 3 | 151µs | 2 | 18.9ms | # spent 18.9ms (17.9+990µs) within Date::Manip::Obj::BEGIN@15 which was called:
# once (17.9ms+990µs) by Date::Manip::Date::BEGIN@14 at line 15 # spent 18.9ms making 1 call to Date::Manip::Obj::BEGIN@15
# spent 4µs making 1 call to UNIVERSAL::import |
| 16 | 3 | 237µs | 2 | 23.4ms | # spent 23.3ms (22.3+1.05) within Date::Manip::Obj::BEGIN@16 which was called:
# once (22.3ms+1.05ms) by Date::Manip::Date::BEGIN@14 at line 16 # spent 23.3ms making 1 call to Date::Manip::Obj::BEGIN@16
# spent 9µs making 1 call to UNIVERSAL::import |
| 17 | |||||
| 18 | 3 | 1.14ms | 2 | 191µs | # spent 107µs (22+85) within Date::Manip::Obj::BEGIN@18 which was called:
# once (22µs+85µs) by Date::Manip::Date::BEGIN@14 at line 18 # spent 107µs making 1 call to Date::Manip::Obj::BEGIN@18
# spent 85µs making 1 call to vars::import |
| 19 | 1 | 700ns | $VERSION='6.11'; | ||
| 20 | |||||
| 21 | ######################################################################## | ||||
| 22 | # METHODS | ||||
| 23 | ######################################################################## | ||||
| 24 | |||||
| 25 | 1 | 15µs | 1 | 9µs | my $dmo_rx = qr/^Date::Manip::(Base|TZ|Date|Delta|Recur)$/; # spent 9µs making 1 call to Date::Manip::Obj::CORE:qr |
| 26 | 1 | 4µs | 1 | 1µs | my $dmh_rx = qr/^Date::Manip::(Date|Delta|Recur)$/; # spent 1µs making 1 call to Date::Manip::Obj::CORE:qr |
| 27 | |||||
| 28 | # spent 17.7ms (765µs+16.9) within Date::Manip::Obj::new which was called 9 times, avg 1.97ms/call:
# 2 times (139µs+-139µs) by Date::Manip::Obj::new at line 104, avg 0s/call
# 2 times (175µs+-175µs) by Date::Manip::Obj::new at line 103, avg 0s/call
# once (134µs+10.2ms) by C4::Overdues::BEGIN@25 at line 66 of Date/Manip.pm
# once (74µs+6.95ms) by C4::Overdues::BEGIN@25 at line 69 of Date/Manip.pm
# once (115µs+46µs) by Date::Manip::Obj::new_delta at line 233
# once (92µs+62µs) by Date::Manip::Obj::new_recur at line 238
# once (37µs+22µs) by Date::Manip::Obj::new_date at line 228 | ||||
| 29 | 9 | 22µs | my(@args) = @_; | ||
| 30 | 9 | 14µs | my(@allargs) = @args; | ||
| 31 | |||||
| 32 | # Get the object or class. | ||||
| 33 | |||||
| 34 | 9 | 11µs | my($self,$class); | ||
| 35 | |||||
| 36 | 9 | 262µs | 36 | 96µs | if (ref($args[0]) =~ $dmo_rx) { # spent 52µs making 18 calls to Date::Manip::Obj::CORE:match, avg 3µs/call
# spent 45µs making 18 calls to Date::Manip::Obj::CORE:regcomp, avg 2µ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 | 9 | 4µs | my $obj; | ||
| 51 | 9 | 77µs | 18 | 24µs | if ($self) { # spent 13µs making 9 calls to Date::Manip::Obj::CORE:regcomp, avg 1µs/call
# spent 11µ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 | 9 | 4µs | my @config; | ||
| 61 | 9 | 6µs | 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 | 9 | 6µs | my($dmt,$dmb); | ||
| 70 | |||||
| 71 | 9 | 8µs | if ($obj) { | ||
| 72 | 5 | 21µs | $dmb = $$obj{'objs'}{'base'} if (exists $$obj{'objs'}{'base'}); | ||
| 73 | 5 | 12µs | $dmt = $$obj{'objs'}{'tz'} if (exists $$obj{'objs'}{'tz'}); | ||
| 74 | } | ||||
| 75 | |||||
| 76 | # Create a new empty object. | ||||
| 77 | |||||
| 78 | 9 | 57µs | my $new = { | ||
| 79 | 'objs' => {}, | ||||
| 80 | 'data' => {}, | ||||
| 81 | 'args' => [ @args ], | ||||
| 82 | 'err' => '', | ||||
| 83 | }; | ||||
| 84 | |||||
| 85 | # Create new Base/TZ objects if necessary | ||||
| 86 | |||||
| 87 | 9 | 6µs | my $init = 1; | ||
| 88 | 9 | 26µs | 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 | 4 | 9µs | 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 { | ||||
| 103 | 2 | 36µs | 2 | 0s | $dmb = new Date::Manip::Base; # spent 15.9ms making 2 calls to Date::Manip::Obj::new, avg 7.94ms/call, recursion: max depth 1, sum of overlapping time 15.9ms |
| 104 | 2 | 23µs | 2 | 0s | $dmt = new Date::Manip::TZ $dmb; # spent 1.14ms making 2 calls to Date::Manip::Obj::new, avg 572µs/call, recursion: max depth 1, sum of overlapping time 1.14ms |
| 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 | 9 | 77µs | bless $new,$class; | ||
| 147 | |||||
| 148 | 9 | 24µs | $$new{'objs'}{'base'} = $dmb; | ||
| 149 | 9 | 9µs | $$new{'objs'}{'tz'} = $dmt if ($dmt); | ||
| 150 | 9 | 12µs | $$dmb{'objs'}{'tz'} = $dmt if ($dmt); | ||
| 151 | |||||
| 152 | 9 | 37µs | 9 | 16.0ms | $new->_init() unless (! $init); # spent 15.7ms making 2 calls to Date::Manip::Base::_init, avg 7.84ms/call
# spent 157µs making 2 calls to Date::Manip::TZ::_init, avg 78µs/call
# spent 54µs making 3 calls to Date::Manip::Date::_init, avg 18µs/call
# spent 43µs making 1 call to Date::Manip::Recur::_init
# spent 18µs making 1 call to Date::Manip::Delta::_init |
| 153 | |||||
| 154 | # Apply configuration options and parse the string. | ||||
| 155 | |||||
| 156 | 9 | 6µs | if (@config) { | ||
| 157 | $dmb->config(@config); | ||||
| 158 | } | ||||
| 159 | |||||
| 160 | 9 | 3µs | $new->_init_args() if (@args); | ||
| 161 | 9 | 47µs | 9 | 847µs | $new->_init_final(); # spent 824µs making 2 calls to Date::Manip::TZ::_init_final, avg 412µs/call
# spent 22µs making 7 calls to Date::Manip::Obj::_init_final, avg 3µs/call |
| 162 | |||||
| 163 | 9 | 46µs | return $new; | ||
| 164 | } | ||||
| 165 | |||||
| 166 | sub _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 22µs within Date::Manip::Obj::_init_final which was called 7 times, avg 3µs/call:
# 7 times (22µs+0s) by Date::Manip::Obj::new at line 161, avg 3µs/call | ||||
| 176 | 7 | 6µs | my($self) = @_; | ||
| 177 | 7 | 21µs | return; | ||
| 178 | } | ||||
| 179 | |||||
| 180 | sub 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 8µs within Date::Manip::Obj::base which was called:
# once (8µs+0s) by C4::Overdues::BEGIN@25 at line 73 of Date/Manip.pm | ||||
| 194 | 1 | 2µs | my($self) = @_; | ||
| 195 | 1 | 11µs | return $$self{'objs'}{'base'}; | ||
| 196 | } | ||||
| 197 | |||||
| 198 | # spent 10µs within Date::Manip::Obj::tz which was called:
# once (10µs+0s) by C4::Overdues::BEGIN@25 at line 74 of Date/Manip.pm | ||||
| 199 | 1 | 2µs | my($self) = @_; | ||
| 200 | 1 | 12µs | return $$self{'objs'}{'tz'} if (exists $$self{'objs'}{'tz'}); | ||
| 201 | return undef; | ||||
| 202 | } | ||||
| 203 | |||||
| 204 | # spent 1.44ms (19µs+1.42) within Date::Manip::Obj::config which was called:
# once (19µs+1.42ms) by C4::Overdues::BEGIN@25 at line 67 of Date/Manip.pm | ||||
| 205 | 1 | 2µs | my($self,@config) = @_; | ||
| 206 | 1 | 2µs | my $dmb = $$self{'objs'}{'base'}; | ||
| 207 | |||||
| 208 | 1 | 7µs | while (@config) { | ||
| 209 | 1 | 2µs | my $var = shift(@config); | ||
| 210 | 1 | 1µs | my $val = shift(@config); | ||
| 211 | 1 | 5µs | 1 | 1.42ms | $dmb->_config_var($var,$val); # spent 1.42ms making 1 call to Date::Manip::Base::_config_var |
| 212 | } | ||||
| 213 | } | ||||
| 214 | |||||
| 215 | sub err { | ||||
| 216 | my($self,$arg) = @_; | ||||
| 217 | if ($arg) { | ||||
| 218 | $$self{'err'} = ''; | ||||
| 219 | return; | ||||
| 220 | } else { | ||||
| 221 | return $$self{'err'}; | ||||
| 222 | } | ||||
| 223 | } | ||||
| 224 | |||||
| 225 | # spent 72µs (13+59) within Date::Manip::Obj::new_date which was called:
# once (13µs+59µs) by C4::Overdues::BEGIN@25 at line 70 of Date/Manip.pm | ||||
| 226 | 1 | 1µs | my(@args) = @_; | ||
| 227 | 1 | 3µs | require Date::Manip::Date; | ||
| 228 | 1 | 9µs | 1 | 59µs | return new Date::Manip::Date @args; # spent 59µs making 1 call to Date::Manip::Obj::new |
| 229 | } | ||||
| 230 | # spent 5.82ms (5.08+735µs) within Date::Manip::Obj::new_delta which was called:
# once (5.08ms+735µs) by C4::Overdues::BEGIN@25 at line 71 of Date/Manip.pm | ||||
| 231 | 1 | 2µs | my(@args) = @_; | ||
| 232 | 1 | 152µs | require Date::Manip::Delta; | ||
| 233 | 1 | 23µs | 1 | 160µs | return new Date::Manip::Delta @args; # spent 160µs making 1 call to Date::Manip::Obj::new |
| 234 | } | ||||
| 235 | # spent 17.1ms (16.3+821µs) within Date::Manip::Obj::new_recur which was called:
# once (16.3ms+821µs) by C4::Overdues::BEGIN@25 at line 72 of Date/Manip.pm | ||||
| 236 | 1 | 2µs | my(@args) = @_; | ||
| 237 | 1 | 173µs | require Date::Manip::Recur; | ||
| 238 | 1 | 18µs | 1 | 154µs | return new Date::Manip::Recur @args; # spent 154µs making 1 call to Date::Manip::Obj::new |
| 239 | } | ||||
| 240 | |||||
| 241 | sub is_date { | ||||
| 242 | return 0; | ||||
| 243 | } | ||||
| 244 | sub is_delta { | ||||
| 245 | return 0; | ||||
| 246 | } | ||||
| 247 | sub is_recur { | ||||
| 248 | return 0; | ||||
| 249 | } | ||||
| 250 | |||||
| 251 | sub 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 | |||||
| 262 | 1 | 18µs | 1; | ||
| 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: | ||||
sub Date::Manip::Obj::CORE:match; # opcode | |||||
sub Date::Manip::Obj::CORE:qr; # opcode | |||||
sub Date::Manip::Obj::CORE:regcomp; # opcode |