← Index
NYTProf Performance Profile   « block view • line view • sub view »
For mentat.storage.mongo.pl
  Run on Tue Jun 24 10:04:38 2014
Reported on Tue Jun 24 10:05:11 2014

Filename/usr/local/share/perl/5.14.2/DateTime/TimeZone/Local.pm
StatementsExecuted 37 statements in 627µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1111.58ms1.69msDateTime::TimeZone::Local::::BEGIN@14DateTime::TimeZone::Local::BEGIN@14
1111.13ms6.00msDateTime::TimeZone::Local::::BEGIN@12DateTime::TimeZone::Local::BEGIN@12
11121µs57.5msDateTime::TimeZone::Local::::TimeZoneDateTime::TimeZone::Local::TimeZone
11120µs4.81msDateTime::TimeZone::Local::::_load_subclassDateTime::TimeZone::Local::_load_subclass
11111µs14µsDateTime::TimeZone::Local::::FromEnvDateTime::TimeZone::Local::FromEnv
1118µs8µsDateTime::TimeZone::Local::::BEGIN@5DateTime::TimeZone::Local::BEGIN@5
1117µs7µsDateTime::TimeZone::Local::::BEGIN@13DateTime::TimeZone::Local::BEGIN@13
1117µs9µsDateTime::TimeZone::Local::::BEGIN@9DateTime::TimeZone::Local::BEGIN@9
1116µs11µsDateTime::TimeZone::Local::::BEGIN@10DateTime::TimeZone::Local::BEGIN@10
1112µs2µ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{
321µs $DateTime::TimeZone::Local::VERSION = '1.63';
4}
5
# spent 8µs within DateTime::TimeZone::Local::BEGIN@5 which was called: # once (8µs+0s) by DateTime::TimeZone::BEGIN@16 at line 7
BEGIN {
615µs $DateTime::TimeZone::Local::AUTHORITY = 'cpan:DROLSKY';
7118µs18µs}
# spent 8µs making 1 call to DateTime::TimeZone::Local::BEGIN@5
8
9220µs212µs
# spent 9µs (7+3) within DateTime::TimeZone::Local::BEGIN@9 which was called: # once (7µs+3µs) by DateTime::TimeZone::BEGIN@16 at line 9
use strict;
# spent 9µs making 1 call to DateTime::TimeZone::Local::BEGIN@9 # spent 3µs making 1 call to strict::import
10224µs216µs
# spent 11µs (6+5) within DateTime::TimeZone::Local::BEGIN@10 which was called: # once (6µs+5µs) by DateTime::TimeZone::BEGIN@16 at line 10
use warnings;
# spent 11µs making 1 call to DateTime::TimeZone::Local::BEGIN@10 # spent 5µs making 1 call to warnings::import
11
122100µs26.05ms
# spent 6.00ms (1.13+4.87) within DateTime::TimeZone::Local::BEGIN@12 which was called: # once (1.13ms+4.87ms) by DateTime::TimeZone::BEGIN@16 at line 12
use Class::Load qw( is_class_loaded load_class try_load_class );
# spent 6.00ms making 1 call to DateTime::TimeZone::Local::BEGIN@12 # spent 44µs making 1 call to Exporter::import
13224µs17µs
# spent 7µs within DateTime::TimeZone::Local::BEGIN@13 which was called: # once (7µs+0s) by DateTime::TimeZone::BEGIN@16 at line 13
use DateTime::TimeZone;
# spent 7µs making 1 call to DateTime::TimeZone::Local::BEGIN@13
142373µs11.69ms
# spent 1.69ms (1.58+112µs) within DateTime::TimeZone::Local::BEGIN@14 which was called: # once (1.58ms+112µs) by DateTime::TimeZone::BEGIN@16 at line 14
use File::Spec;
# spent 1.69ms making 1 call to DateTime::TimeZone::Local::BEGIN@14
15
16
# spent 57.5ms (21µs+57.5) within DateTime::TimeZone::Local::TimeZone which was called: # once (21µs+57.5ms) by DateTime::TimeZone::new at line 57 of DateTime/TimeZone.pm
sub TimeZone {
1737µs my $class = shift;
18
1914.81ms my $subclass = $class->_load_subclass();
# spent 4.81ms making 1 call to DateTime::TimeZone::Local::_load_subclass
20
2112µs for my $meth ( $subclass->Methods() ) {
# spent 2µs making 1 call to DateTime::TimeZone::Local::Unix::Methods
2249µs252.7ms my $tz = $subclass->$meth();
# spent 52.7ms making 1 call to DateTime::TimeZone::Local::Unix::FromEtcLocaltime # spent 14µs making 1 call to DateTime::TimeZone::Local::FromEnv
23
24 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.
3425µ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 4.81ms (20µs+4.79) within DateTime::TimeZone::Local::_load_subclass which was called: # once (20µs+4.79ms) by DateTime::TimeZone::Local::TimeZone at line 19
sub _load_subclass {
47824µs my $class = shift;
48
49 my $os_name = $subclass{$^O} || $^O;
50 my $subclass = $class . '::' . $os_name;
51
5215µs return $subclass if is_class_loaded($subclass);
# spent 5µs making 1 call to Class::Load::XS::is_class_loaded
53
541185µs return $subclass if try_load_class($subclass);
# spent 185µs making 1 call to Class::Load::try_load_class
55
56 $subclass = $class . '::Unix';
57
5814.60ms load_class($subclass);
# spent 4.60ms making 1 call to Class::Load::load_class
59
60 return $subclass;
61 }
62}
63
64
# spent 14µs (11+3) within DateTime::TimeZone::Local::FromEnv which was called: # once (11µs+3µs) by DateTime::TimeZone::Local::TimeZone at line 22
sub FromEnv {
6534µs my $class = shift;
66
671800ns foreach my $var ( $class->EnvVars() ) {
# spent 800ns making 1 call to DateTime::TimeZone::Local::Unix::EnvVars
6815µs12µs if ( $class->_IsValidName( $ENV{$var} ) ) {
# spent 2µ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
79 return;
80}
81
82
# spent 2µs within DateTime::TimeZone::Local::_IsValidName which was called: # once (2µs+0s) by DateTime::TimeZone::Local::FromEnv at line 68
sub _IsValidName {
8324µs shift;
84
85 return 0 unless defined $_[0];
86 return 0 if $_[0] eq 'local';
87
88 return $_[0] =~ m{^[\w/\-\+]+$};
89}
90
9114µs1;
92
93# ABSTRACT: Determine the local system's time zone
94
95__END__