← Index
NYTProf Performance Profile   « block view • line view • sub view »
For mentat.storage.mongo.pl
  Run on Tue Jun 24 09:58:41 2014
Reported on Tue Jun 24 09:59:29 2014

Filename/usr/local/share/perl/5.14.2/DateTime/TimeZone/Local.pm
StatementsExecuted 37 statements in 1.40ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1113.56ms3.81msDateTime::TimeZone::Local::::BEGIN@14DateTime::TimeZone::Local::BEGIN@14
1112.54ms13.6msDateTime::TimeZone::Local::::BEGIN@12DateTime::TimeZone::Local::BEGIN@12
11147µs121msDateTime::TimeZone::Local::::TimeZoneDateTime::TimeZone::Local::TimeZone
11146µs10.8msDateTime::TimeZone::Local::::_load_subclassDateTime::TimeZone::Local::_load_subclass
11125µs32µsDateTime::TimeZone::Local::::FromEnvDateTime::TimeZone::Local::FromEnv
11118µs18µsDateTime::TimeZone::Local::::BEGIN@5DateTime::TimeZone::Local::BEGIN@5
11117µs17µsDateTime::TimeZone::Local::::BEGIN@13DateTime::TimeZone::Local::BEGIN@13
11115µs22µsDateTime::TimeZone::Local::::BEGIN@9DateTime::TimeZone::Local::BEGIN@9
11115µs26µsDateTime::TimeZone::Local::::BEGIN@10DateTime::TimeZone::Local::BEGIN@10
1115µs5µsDateTime::TimeZone::Local::::_IsValidNameDateTime::TimeZone::Local::_IsValidName
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package DateTime::TimeZone::Local;
2{
322µs $DateTime::TimeZone::Local::VERSION = '1.63';
4}
5
# spent 18µs within DateTime::TimeZone::Local::BEGIN@5 which was called: # once (18µs+0s) by DateTime::TimeZone::BEGIN@16 at line 7
BEGIN {
6111µs $DateTime::TimeZone::Local::AUTHORITY = 'cpan:DROLSKY';
7141µs118µs}
# spent 18µs making 1 call to DateTime::TimeZone::Local::BEGIN@5
8
9246µs229µs
# spent 22µs (15+7) within DateTime::TimeZone::Local::BEGIN@9 which was called: # once (15µs+7µs) by DateTime::TimeZone::BEGIN@16 at line 9
use strict;
# spent 22µs making 1 call to DateTime::TimeZone::Local::BEGIN@9 # spent 7µs making 1 call to strict::import
10255µs237µs
# spent 26µs (15+11) within DateTime::TimeZone::Local::BEGIN@10 which was called: # once (15µs+11µs) by DateTime::TimeZone::BEGIN@16 at line 10
use warnings;
# spent 26µs making 1 call to DateTime::TimeZone::Local::BEGIN@10 # spent 11µs making 1 call to warnings::import
11
122212µs213.7ms
# spent 13.6ms (2.54+11.1) within DateTime::TimeZone::Local::BEGIN@12 which was called: # once (2.54ms+11.1ms) by DateTime::TimeZone::BEGIN@16 at line 12
use Class::Load qw( is_class_loaded load_class try_load_class );
# spent 13.6ms making 1 call to DateTime::TimeZone::Local::BEGIN@12 # spent 99µs making 1 call to Exporter::import
13256µs117µs
# spent 17µs within DateTime::TimeZone::Local::BEGIN@13 which was called: # once (17µs+0s) by DateTime::TimeZone::BEGIN@16 at line 13
use DateTime::TimeZone;
# spent 17µs making 1 call to DateTime::TimeZone::Local::BEGIN@13
142839µs13.81ms
# spent 3.81ms (3.56+250µs) within DateTime::TimeZone::Local::BEGIN@14 which was called: # once (3.56ms+250µs) by DateTime::TimeZone::BEGIN@16 at line 14
use File::Spec;
# spent 3.81ms making 1 call to DateTime::TimeZone::Local::BEGIN@14
15
16
# spent 121ms (47µs+121) within DateTime::TimeZone::Local::TimeZone which was called: # once (47µs+121ms) by DateTime::TimeZone::new at line 57 of DateTime/TimeZone.pm
sub TimeZone {
1711µs my $class = shift;
18
1913µs110.8ms my $subclass = $class->_load_subclass();
# spent 10.8ms making 1 call to DateTime::TimeZone::Local::_load_subclass
20
21111µs15µs for my $meth ( $subclass->Methods() ) {
# spent 5µs making 1 call to DateTime::TimeZone::Local::Unix::Methods
22213µs2110ms my $tz = $subclass->$meth();
# spent 110ms making 1 call to DateTime::TimeZone::Local::Unix::FromEtcLocaltime # spent 32µs making 1 call to DateTime::TimeZone::Local::FromEnv
23
2428µs return $tz if $tz;
25 }
26
27 die "Cannot determine local time zone\n";
28}
29
30{
31 # Stolen from File::Spec. My theory is that other folks can write
32 # the non-existent modules if they feel a need, and release them
33 # to CPAN separately.
34211µs my %subclass = (
35 MSWin32 => 'Win32',
36 VMS => 'VMS',
37 MacOS => 'Mac',
38 os2 => 'OS2',
39 epoc => 'Epoc',
40 NetWare => 'Win32',
41 symbian => 'Win32',
42 dos => 'OS2',
43 cygwin => 'Unix',
44 );
45
46
# spent 10.8ms (46µs+10.8) within DateTime::TimeZone::Local::_load_subclass which was called: # once (46µs+10.8ms) by DateTime::TimeZone::Local::TimeZone at line 19
sub _load_subclass {
471600ns my $class = shift;
48
4914µs my $os_name = $subclass{$^O} || $^O;
5012µs my $subclass = $class . '::' . $os_name;
51
52118µs17µs return $subclass if is_class_loaded($subclass);
# spent 7µs making 1 call to Class::Load::XS::is_class_loaded
53
54115µs1398µs return $subclass if try_load_class($subclass);
# spent 398µs making 1 call to Class::Load::try_load_class
55
561900ns $subclass = $class . '::Unix';
57
5813µs110.4ms load_class($subclass);
# spent 10.4ms making 1 call to Class::Load::load_class
59
6017µs return $subclass;
61 }
62}
63
64
# spent 32µs (25+7) within DateTime::TimeZone::Local::FromEnv which was called: # once (25µs+7µs) by DateTime::TimeZone::Local::TimeZone at line 22
sub FromEnv {
6511µs my $class = shift;
66
6713µs12µs foreach my $var ( $class->EnvVars() ) {
# spent 2µs making 1 call to DateTime::TimeZone::Local::Unix::EnvVars
68112µs15µs if ( $class->_IsValidName( $ENV{$var} ) ) {
# spent 5µs making 1 call to DateTime::TimeZone::Local::_IsValidName
69 my $tz;
70 {
71 local $@;
72 local $SIG{__DIE__};
73 $tz = eval { DateTime::TimeZone->new( name => $ENV{$var} ) };
74 }
75 return $tz if $tz;
76 }
77 }
78
7915µs return;
80}
81
82
# spent 5µs within DateTime::TimeZone::Local::_IsValidName which was called: # once (5µs+0s) by DateTime::TimeZone::Local::FromEnv at line 68
sub _IsValidName {
831300ns shift;
84
8518µs return 0 unless defined $_[0];
86 return 0 if $_[0] eq 'local';
87
88 return $_[0] =~ m{^[\w/\-\+]+$};
89}
90
91112µs1;
92
93# ABSTRACT: Determine the local system's time zone
94
95__END__