Profile of /usr/local/lib/perl5/site_perl/5.10.1/DateTime/TimeZone/OffsetOnly.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For 05.Domain_and_Item.t
Run on Tue May 4 17:21:41 2010
Reported on Tue May 4 17:22:52 2010

File | /usr/local/lib/perl5/site_perl/5.10.1/DateTime/TimeZone/OffsetOnly.pm
Statements Executed | 85
Statement Execution Time | 918µs

Subroutines — ordered by exclusive time
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 242µs | 329µs | DateTime::TimeZone::OffsetOnly::::BEGIN@11DateTime::TimeZone::OffsetOnly::BEGIN@11
10 | 1 | 1 | 181µs | 781µs | DateTime::TimeZone::OffsetOnly::::newDateTime::TimeZone::OffsetOnly::new
2 | 1 | 1 | 18µs | 23µs | DateTime::TimeZone::OffsetOnly::::STORABLE_freezeDateTime::TimeZone::OffsetOnly::STORABLE_freeze
1 | 1 | 1 | 18µs | 20µs | DateTime::TimeZone::OffsetOnly::::BEGIN@3DateTime::TimeZone::OffsetOnly::BEGIN@3
1 | 1 | 1 | 10µs | 56µs | DateTime::TimeZone::OffsetOnly::::BEGIN@12DateTime::TimeZone::OffsetOnly::BEGIN@12
8 | 2 | 1 | 10µs | 10µs | DateTime::TimeZone::OffsetOnly::::is_utcDateTime::TimeZone::OffsetOnly::is_utc
1 | 1 | 1 | 7µs | 66µs | DateTime::TimeZone::OffsetOnly::::BEGIN@9DateTime::TimeZone::OffsetOnly::BEGIN@9
1 | 1 | 1 | 6µs | 25µs | DateTime::TimeZone::OffsetOnly::::BEGIN@5DateTime::TimeZone::OffsetOnly::BEGIN@5
2 | 1 | 1 | 5µs | 5µs | DateTime::TimeZone::OffsetOnly::::offset_for_datetimeDateTime::TimeZone::OffsetOnly::offset_for_datetime
1 | 1 | 1 | 4µs | 4µs | DateTime::TimeZone::OffsetOnly::::BEGIN@8DateTime::TimeZone::OffsetOnly::BEGIN@8
0 | 0 | 0 | 0s | 0s | DateTime::TimeZone::OffsetOnly::::STORABLE_thawDateTime::TimeZone::OffsetOnly::STORABLE_thaw
0 | 0 | 0 | 0s | 0s | DateTime::TimeZone::OffsetOnly::::categoryDateTime::TimeZone::OffsetOnly::category
0 | 0 | 0 | 0s | 0s | DateTime::TimeZone::OffsetOnly::::is_dst_for_datetimeDateTime::TimeZone::OffsetOnly::is_dst_for_datetime
0 | 0 | 0 | 0s | 0s | DateTime::TimeZone::OffsetOnly::::offset_for_local_datetimeDateTime::TimeZone::OffsetOnly::offset_for_local_datetime
0 | 0 | 0 | 0s | 0s | DateTime::TimeZone::OffsetOnly::::short_name_for_datetimeDateTime::TimeZone::OffsetOnly::short_name_for_datetime

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package DateTime::TimeZone::OffsetOnly;
2 |  |  |  |  |
3 | 3 | 25µs | 2 | 23µs | # spent 20µs (18+3) within DateTime::TimeZone::OffsetOnly::BEGIN@3 which was called # once (18µs+3µs) by base::import at line 3 use strict; # spent 20µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@3 # spent 3µs making 1 call to strict::import
4 |  |  |  |  |
5 | 3 | 27µs | 2 | 44µs | # spent 25µs (6+19) within DateTime::TimeZone::OffsetOnly::BEGIN@5 which was called # once (6µs+19µs) by base::import at line 5 use vars qw ($VERSION); # spent 25µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@5 # spent 19µs making 1 call to vars::import
6 | 1 | 300ns |  |  | $VERSION = 0.02;
7 |  |  |  |  |
8 | 3 | 21µs | 1 | 4µs | # spent 4µs within DateTime::TimeZone::OffsetOnly::BEGIN@8 which was called # once (4µs+0s) by base::import at line 8 use DateTime::TimeZone; # spent 4µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@8
9 | 3 | 24µs | 2 | 66µs | # spent 66µs (7+58) within DateTime::TimeZone::OffsetOnly::BEGIN@9 which was called # once (7µs+58µs) by base::import at line 9 use base 'DateTime::TimeZone'; # spent 66µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@9 # spent 59µs making 1 call to base::import, recursion: max depth 1, time 59µs
10 |  |  |  |  |
11 | 3 | 108µs | 1 | 329µs | # spent 329µs (242+87) within DateTime::TimeZone::OffsetOnly::BEGIN@11 which was called # once (242µs+87µs) by base::import at line 11 use DateTime::TimeZone::UTC; # spent 329µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@11
12 | 3 | 231µs | 2 | 102µs | # spent 56µs (10+46) within DateTime::TimeZone::OffsetOnly::BEGIN@12 which was called # once (10µs+46µs) by base::import at line 12 use Params::Validate qw( validate SCALAR ); # spent 56µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@12 # spent 46µs making 1 call to Exporter::import
13 |  |  |  |  |
14 |  |  |  |  | # spent 781µs (181+600) within DateTime::TimeZone::OffsetOnly::new which was called 10 times, avg 78µs/call: # 10 times (181µs+600µs) by DateTime::TimeZone::new at line 60 of DateTime/TimeZone.pm, avg 78µs/call sub new {
15 | 50 | 241µs |  |  | my $class = shift;
16 | 1 | 183µs | 10 | 254µs | my %p = validate( # spent 254µs making 10 calls to Params::Validate::_validate, avg 25µs/call
17 |  |  |  |  | @_, {
18 |  |  |  |  | offset => { type => SCALAR },
19 |  |  |  |  | }
20 |  |  |  |  | );
21 |  |  |  |  |
22 |  |  |  |  | my $offset = DateTime::TimeZone::offset_as_seconds( $p{offset} ); # spent 308µs making 10 calls to DateTime::TimeZone::offset_as_seconds, avg 31µs/call
23 |  |  |  |  |
24 |  |  |  |  | die "Invalid offset: $p{offset}\n" unless defined $offset;
25 |  |  |  |  |
26 |  |  |  |  | return DateTime::TimeZone::UTC->new unless $offset; # spent 39µs making 10 calls to DateTime::TimeZone::UTC::new, avg 4µs/call
27 |  |  |  |  |
28 |  |  |  |  | my $self = {
29 |  |  |  |  | name => DateTime::TimeZone::offset_as_string($offset),
30 |  |  |  |  | offset => $offset,
31 |  |  |  |  | };
32 |  |  |  |  |
33 |  |  |  |  | return bless $self, $class;
34 |  |  |  |  | }
35 |  |  |  |  |
36 |  |  |  |  | sub is_dst_for_datetime {0}
37 |  |  |  |  |
38 | 2 | 11µs |  |  | # spent 5µs within DateTime::TimeZone::OffsetOnly::offset_for_datetime which was called 2 times, avg 2µs/call: # 2 times (5µs+0s) by DateTime::offset at line 905 of DateTime.pm, avg 2µs/call sub offset_for_datetime { $_[0]->{offset} }
39 |  |  |  |  | sub offset_for_local_datetime { $_[0]->{offset} }
40 |  |  |  |  |
41 | 8 | 28µs |  |  | # spent 10µs within DateTime::TimeZone::OffsetOnly::is_utc which was called 8 times, avg 1µs/call: # 4 times (7µs+0s) by DateTime::_calc_utc_rd at line 338 of DateTime.pm, avg 2µs/call # 4 times (3µs+0s) by DateTime::_calc_local_rd at line 379 of DateTime.pm, avg 775ns/call sub is_utc {0}
42 |  |  |  |  |
43 |  |  |  |  | sub short_name_for_datetime { $_[0]->name }
44 |  |  |  |  |
45 |  |  |  |  | sub category {undef}
46 |  |  |  |  |
47 |  |  |  |  | # spent 23µs (18+5) within DateTime::TimeZone::OffsetOnly::STORABLE_freeze which was called 2 times, avg 12µs/call: # 2 times (18µs+5µs) by Storable::net_mstore at line 339 of Storable.pm, avg 12µs/call sub STORABLE_freeze {
48 | 4 | 16µs |  |  | my $self = shift;
49 |  |  |  |  |
50 |  |  |  |  | return $self->name; # spent 5µs making 2 calls to DateTime::TimeZone::name, avg 3µs/call
51 |  |  |  |  | }
52 |  |  |  |  |
53 |  |  |  |  | sub STORABLE_thaw {
54 |  |  |  |  | my $self = shift;
55 |  |  |  |  | my $cloning = shift;
56 |  |  |  |  | my $serialized = shift;
57 |  |  |  |  |
58 |  |  |  |  | my $class = ref $self || $self;
59 |  |  |  |  |
60 |  |  |  |  | my $obj;
61 |  |  |  |  | if ( $class->isa(__PACKAGE__) ) {
62 |  |  |  |  | $obj = __PACKAGE__->new( offset => $serialized );
63 |  |  |  |  | }
64 |  |  |  |  | else {
65 |  |  |  |  | $obj = $class->new( offset => $serialized );
66 |  |  |  |  | }
67 |  |  |  |  |
68 |  |  |  |  | %$self = %$obj;
69 |  |  |  |  |
70 |  |  |  |  | return $self;
71 |  |  |  |  | }
72 |  |  |  |  |
73 | 1 | 3µs |  |  | 1;
74 |  |  |  |  |
75 |  |  |  |  | __END__
76 |  |  |  |  |
77 |  |  |  |  | =head1 NAME
78 |  |  |  |  |
79 |  |  |  |  | DateTime::TimeZone::OffsetOnly - A DateTime::TimeZone object that just contains an offset
80 |  |  |  |  |
81 |  |  |  |  | =head1 SYNOPSIS
82 |  |  |  |  |
83 |  |  |  |  | my $offset_tz = DateTime::TimeZone->new( name => '-0300' );
84 |  |  |  |  |
85 |  |  |  |  | =head1 DESCRIPTION
86 |  |  |  |  |
87 |  |  |  |  | This class is used to provide the DateTime::TimeZone API needed by
88 |  |  |  |  | DateTime.pm, but with a fixed offset. An object in this class always
89 |  |  |  |  | returns the same offset as was given in its constructor, regardless of
90 |  |  |  |  | the date.
91 |  |  |  |  |
92 |  |  |  |  | =head1 USAGE
93 |  |  |  |  |
94 |  |  |  |  | This class has the same methods as a real time zone object, but the
95 |  |  |  |  | C<category()> method returns undef.
96 |  |  |  |  |
97 |  |  |  |  | =head2 DateTime::TimeZone::OffsetOnly->new ( offset => $offset )
98 |  |  |  |  |
99 |  |  |  |  | The value given to the offset parameter must be a string such as
100 |  |  |  |  | "+0300". Strings will be converted into numbers by the
101 |  |  |  |  | C<DateTime::TimeZone::offset_as_seconds()> function.
102 |  |  |  |  |
103 |  |  |  |  | =head2 $tz->offset_for_datetime( $datetime )
104 |  |  |  |  |
105 |  |  |  |  | No matter what date is given, the offset provided to the constructor
106 |  |  |  |  | is always used.
107 |  |  |  |  |
108 |  |  |  |  | =head2 $tz->name()
109 |  |  |  |  |
110 |  |  |  |  | =head2 $tz->short_name_for_datetime()
111 |  |  |  |  |
112 |  |  |  |  | Both of these methods return the offset in string form.
113 |  |  |  |  |
114 |  |  |  |  | =head1 AUTHOR
115 |  |  |  |  |
116 |  |  |  |  | Dave Rolsky, <autarch@urth.org>
117 |  |  |  |  |
118 |  |  |  |  | =head1 COPYRIGHT & LICENSE
119 |  |  |  |  |
120 |  |  |  |  | Copyright (c) 2003-2008 David Rolsky. All rights reserved. This
121 |  |  |  |  | program is free software; you can redistribute it and/or modify it
122 |  |  |  |  | under the same terms as Perl itself.
123 |  |  |  |  |
124 |  |  |  |  | The full text of the license can be found in the LICENSE file included
125 |  |  |  |  | with this module.
126 |  |  |  |  |
127 |  |  |  |  | =cut