← Index
NYTProf Performance Profile   « block view • line view • sub view »
For xt/tapper-mcp-scheduler-with-db-longrun.t
  Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:24:09 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DateTime/Format/SQLite.pm
StatementsExecuted 1196 statements in 7.76ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
294227.83ms77.9msDateTime::Format::SQLite::::format_datetimeDateTime::Format::SQLite::format_datetime
1112.85ms9.82msDateTime::Format::SQLite::::BEGIN@16DateTime::Format::SQLite::BEGIN@16
11120µs26µsDateTime::Format::SQLite::::BEGIN@5DateTime::Format::SQLite::BEGIN@5
11115µs32µsDateTime::Format::SQLite::::BEGIN@7DateTime::Format::SQLite::BEGIN@7
71112µs12µsDateTime::Format::SQLite::::CORE:qrDateTime::Format::SQLite::CORE:qr (opcode)
11110µs37µsDateTime::Format::SQLite::::BEGIN@6DateTime::Format::SQLite::BEGIN@6
0000s0sDateTime::Format::SQLite::::__ANON__[:60]DateTime::Format::SQLite::__ANON__[:60]
0000s0sDateTime::Format::SQLite::::__ANON__[:68]DateTime::Format::SQLite::__ANON__[:68]
0000s0sDateTime::Format::SQLite::::_fix_nanosecondsDateTime::Format::SQLite::_fix_nanoseconds
0000s0sDateTime::Format::SQLite::::format_dateDateTime::Format::SQLite::format_date
0000s0sDateTime::Format::SQLite::::format_juliandayDateTime::Format::SQLite::format_julianday
0000s0sDateTime::Format::SQLite::::format_timeDateTime::Format::SQLite::format_time
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# $Id: SQLite.pm 4363 2009-12-10 16:47:25Z cfaerber $
2#
3package DateTime::Format::SQLite;
4
5329µs231µs
# spent 26µs (20+6) within DateTime::Format::SQLite::BEGIN@5 which was called: # once (20µs+6µs) by Class::C3::Componentised::ensure_class_loaded at line 5
use strict;
# spent 26µs making 1 call to DateTime::Format::SQLite::BEGIN@5 # spent 6µs making 1 call to strict::import
6321µs265µs
# spent 37µs (10+27) within DateTime::Format::SQLite::BEGIN@6 which was called: # once (10µs+27µs) by Class::C3::Componentised::ensure_class_loaded at line 6
use vars qw ($VERSION);
# spent 37µs making 1 call to DateTime::Format::SQLite::BEGIN@6 # spent 27µs making 1 call to vars::import
73353µs249µs
# spent 32µs (15+17) within DateTime::Format::SQLite::BEGIN@7 which was called: # once (15µs+17µs) by Class::C3::Componentised::ensure_class_loaded at line 7
use warnings;
# spent 32µs making 1 call to DateTime::Format::SQLite::BEGIN@7 # spent 17µs making 1 call to warnings::import
8
91600nsour $VERSION = '0.11';
1022µs$VERSION = eval { $VERSION };
11
12# "days since noon in Greenwich on November 24, 4714 B.C."
1314µsmy %jd0 = ( 'year' => -4713, 'month' => 11, 'day' => 24, 'hour' => 12, time_zone => 'UTC' );
14
15use DateTime::Format::Builder
16
# spent 9.82ms (2.85+6.97) within DateTime::Format::SQLite::BEGIN@16 which was called: # once (2.85ms+6.97ms) by Class::C3::Componentised::ensure_class_loaded at line 72
( parsers =>
17 { parse_datetime =>
18 [
19 # format 1
20 #
21 { params => [ qw( year month day ) ],
22 regex => qr/^(-?\d+)-(\d+)-(\d+)$/,
23 extra => { time_zone => 'UTC' },
24 },
25
26 # formats 2 and 5
27 #
28 { params => [ qw( year month day hour minute ) ],
29 regex => qr/^(-?\d+)-(\d{1,2})-(\d{1,2})[Tt ](\d{1,2}):(\d{1,2})$/,
30 extra => { time_zone => 'UTC' },
31 },
32
33 # formats 3, 4, 6 and 7
34 #
35 { params => [ qw( year month day hour minute second nanosecond ) ],
36 regex => qr/^(-?\d+)-(\d{1,2})-(\d{1,2})[Tt ](\d{1,2}):(\d{1,2}):(\d{1,2})(\.\d*)?$/,
37 extra => { time_zone => 'UTC' },
38 postprocess => \&_fix_nanoseconds,
39 },
40
41 # format 8
42 #
43 { params => [ qw( hour minute ) ],
44 regex => qr/^(\d{1,2}):(\d{1,2})$/,
45 extra => { time_zone => 'UTC', 'year' => 2000, },
46 },
47
48 # format 9, 10
49 #
50 { params => [ qw( hour minute second nanosecond ) ],
51 regex => qr/^(\d{1,2}):(\d{1,2}):(\d{1,2})(\.\d*)?$/,
52 extra => { time_zone => 'UTC', 'year' => 2000, },
53 postprocess => \&_fix_nanoseconds,
54 },
55
56 # format 11
57 #
58 { params => [ qw ( dummy ) ],
59 regex => qr/^([Nn][Oo][Ww])$/,
60 constructor => sub { return DateTime->now },
61 },
62
63 # format 12
64 #
65 { params => [ qw( jd secs ) ],
66 regex => qr/^(\d+(\.\d*)?)$/,
67 constructor => sub { shift; my %p=(@_); return DateTime->new(%jd0)->add(
68 'days' => int($p{'jd'}), 'seconds' => ($p{'secs'} || 0) * (3600 * 24) ); },
69 },
70176µs81.59ms ]
# spent 1.57ms making 1 call to DateTime::Format::Builder::import # spent 12µs making 7 calls to DateTime::Format::SQLite::CORE:qr, avg 2µs/call
71 },
722305µs19.82ms );
# spent 9.82ms making 1 call to DateTime::Format::SQLite::BEGIN@16
73
7411µs*parse_date = \&parse_datetime;
751600ns*parse_time = \&parse_datetime;
761400ns*parse_julianday = \&parse_datetime;
77
78sub format_date
79{
80 my ( $self, $dt ) = @_;
81
82 $dt = $dt->clone;
83 $dt->set_time_zone('UTC');
84
85 return $dt->ymd('-');
86}
87
88sub format_time
89{
90 my ( $self, $dt ) = @_;
91
92 $dt = $dt->clone;
93 $dt->set_time_zone('UTC');
94
95 return $dt->hms(':');
96}
97
98sub format_datetime
99
# spent 77.9ms (7.83+70.0) within DateTime::Format::SQLite::format_datetime which was called 294 times, avg 265µs/call: # 147 times (5.01ms+36.1ms) by Tapper::MCP::Scheduler::Controller::mark_job_as_running at line 135 of lib/Tapper/MCP/Scheduler/Controller.pm, avg 280µs/call # 147 times (2.82ms+33.9ms) by DBIx::Class::InflateColumn::DateTime::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DBIx/Class/InflateColumn/DateTime.pm:202] at line 201 of DBIx/Class/InflateColumn/DateTime.pm, avg 250µs/call
{
100294384µs my ( $self, $dt ) = @_;
101
1022941.25ms2943.94ms $dt = $dt->clone;
# spent 3.94ms making 294 calls to DateTime::clone, avg 13µs/call
1032941.12ms29459.5ms $dt->set_time_zone('UTC');
# spent 59.5ms making 294 calls to DateTime::set_time_zone, avg 202µs/call
104
1052944.22ms5886.63ms return join ' ', $dt->ymd('-'), $dt->hms(':');
# spent 4.61ms making 294 calls to DateTime::ymd, avg 16µs/call # spent 2.02ms making 294 calls to DateTime::hms, avg 7µs/call
106}
107
108
109sub format_julianday
110{
111 my ( $self, $dt ) = @_;
112
113 return $dt->jd;
114}
115
116sub _fix_nanoseconds
117{
118 my %args = @_;
119 $args{'parsed'}->{'nanosecond'} ||= 0;
120 $args{'parsed'}->{'nanosecond'} *= 1000 * 1000 * 1000;
121 1;
122}
123
12416µs1;
125
126__END__
 
# spent 12µs within DateTime::Format::SQLite::CORE:qr which was called 7 times, avg 2µs/call: # 7 times (12µs+0s) by DateTime::Format::SQLite::BEGIN@16 at line 70, avg 2µs/call
sub DateTime::Format::SQLite::CORE:qr; # opcode