← 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:23:15 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DBIx/Class/Storage/DBI/SQLite.pm
StatementsExecuted 43308 statements in 209ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
801911208ms456msDBIx::Class::Storage::DBI::SQLite::::_dbi_attrs_for_bindDBIx::Class::Storage::DBI::SQLite::_dbi_attrs_for_bind
1411131µs185µsDBIx::Class::Storage::DBI::SQLite::::bind_attribute_by_data_typeDBIx::Class::Storage::DBI::SQLite::bind_attribute_by_data_type
422115µs254msDBIx::Class::Storage::DBI::SQLite::::deployment_statementsDBIx::Class::Storage::DBI::SQLite::deployment_statements
141138µs38µsDBIx::Class::Storage::DBI::SQLite::::CORE:matchDBIx::Class::Storage::DBI::SQLite::CORE:match (opcode)
11120µs25µsDBIx::Class::Storage::DBI::SQLite::::BEGIN@3DBIx::Class::Storage::DBI::SQLite::BEGIN@3
65210µs11µsDBIx::Class::Storage::DBI::SQLite::::_dbh_autocommitDBIx::Class::Storage::DBI::SQLite::_dbh_autocommit (xsub)
11110µs30µsDBIx::Class::Storage::DBI::SQLite::::BEGIN@4DBIx::Class::Storage::DBI::SQLite::BEGIN@4
5539µs9µsDBIx::Class::Storage::DBI::SQLite::::debugDBIx::Class::Storage::DBI::SQLite::debug (xsub)
5539µs9µsDBIx::Class::Storage::DBI::SQLite::::transaction_depthDBIx::Class::Storage::DBI::SQLite::transaction_depth (xsub)
1119µs102µsDBIx::Class::Storage::DBI::SQLite::::BEGIN@9DBIx::Class::Storage::DBI::SQLite::BEGIN@9
1119µs102µsDBIx::Class::Storage::DBI::SQLite::::BEGIN@6DBIx::Class::Storage::DBI::SQLite::BEGIN@6
1118µs46µsDBIx::Class::Storage::DBI::SQLite::::BEGIN@10DBIx::Class::Storage::DBI::SQLite::BEGIN@10
1118µs179µsDBIx::Class::Storage::DBI::SQLite::::BEGIN@11DBIx::Class::Storage::DBI::SQLite::BEGIN@11
1117µs17µsDBIx::Class::Storage::DBI::SQLite::::BEGIN@7DBIx::Class::Storage::DBI::SQLite::BEGIN@7
3323µs3µsDBIx::Class::Storage::DBI::SQLite::::_conn_pidDBIx::Class::Storage::DBI::SQLite::_conn_pid (xsub)
2222µs2µsDBIx::Class::Storage::DBI::SQLite::::unsafeDBIx::Class::Storage::DBI::SQLite::unsafe (xsub)
2222µs2µsDBIx::Class::Storage::DBI::SQLite::::disable_sth_cachingDBIx::Class::Storage::DBI::SQLite::disable_sth_caching (xsub)
2222µs2µsDBIx::Class::Storage::DBI::SQLite::::on_connect_callDBIx::Class::Storage::DBI::SQLite::on_connect_call (xsub)
2221µs1µsDBIx::Class::Storage::DBI::SQLite::::on_connect_doDBIx::Class::Storage::DBI::SQLite::on_connect_do (xsub)
0000s0sDBIx::Class::Storage::DBI::SQLite::::_exec_svp_beginDBIx::Class::Storage::DBI::SQLite::_exec_svp_begin
0000s0sDBIx::Class::Storage::DBI::SQLite::::_exec_svp_releaseDBIx::Class::Storage::DBI::SQLite::_exec_svp_release
0000s0sDBIx::Class::Storage::DBI::SQLite::::_exec_svp_rollbackDBIx::Class::Storage::DBI::SQLite::_exec_svp_rollback
0000s0sDBIx::Class::Storage::DBI::SQLite::::backupDBIx::Class::Storage::DBI::SQLite::backup
0000s0sDBIx::Class::Storage::DBI::SQLite::::connect_call_use_foreign_keysDBIx::Class::Storage::DBI::SQLite::connect_call_use_foreign_keys
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package DBIx::Class::Storage::DBI::SQLite;
2
3322µs230µs
# spent 25µs (20+5) within DBIx::Class::Storage::DBI::SQLite::BEGIN@3 which was called: # once (20µs+5µs) by Class::C3::Componentised::ensure_class_loaded at line 3
use strict;
# spent 25µs making 1 call to DBIx::Class::Storage::DBI::SQLite::BEGIN@3 # spent 5µs making 1 call to strict::import
4327µs251µs
# spent 30µs (10+21) within DBIx::Class::Storage::DBI::SQLite::BEGIN@4 which was called: # once (10µs+21µs) by Class::C3::Componentised::ensure_class_loaded at line 4
use warnings;
# spent 30µs making 1 call to DBIx::Class::Storage::DBI::SQLite::BEGIN@4 # spent 21µs making 1 call to warnings::import
5
6322µs2196µs
# spent 102µs (9+94) within DBIx::Class::Storage::DBI::SQLite::BEGIN@6 which was called: # once (9µs+94µs) by Class::C3::Componentised::ensure_class_loaded at line 6
use base qw/DBIx::Class::Storage::DBI/;
# spent 102µs making 1 call to DBIx::Class::Storage::DBI::SQLite::BEGIN@6 # spent 94µs making 1 call to base::import
7320µs226µs
# spent 17µs (7+10) within DBIx::Class::Storage::DBI::SQLite::BEGIN@7 which was called: # once (7µs+10µs) by Class::C3::Componentised::ensure_class_loaded at line 7
use mro 'c3';
# spent 17µs making 1 call to DBIx::Class::Storage::DBI::SQLite::BEGIN@7 # spent 10µs making 1 call to mro::import
8
9321µs2196µs
# spent 102µs (9+93) within DBIx::Class::Storage::DBI::SQLite::BEGIN@9 which was called: # once (9µs+93µs) by Class::C3::Componentised::ensure_class_loaded at line 9
use DBIx::Class::Carp;
# spent 102µs making 1 call to DBIx::Class::Storage::DBI::SQLite::BEGIN@9 # spent 93µs making 1 call to DBIx::Class::Carp::import
10320µs283µs
# spent 46µs (8+37) within DBIx::Class::Storage::DBI::SQLite::BEGIN@10 which was called: # once (8µs+37µs) by Class::C3::Componentised::ensure_class_loaded at line 10
use Scalar::Util 'looks_like_number';
# spent 46µs making 1 call to DBIx::Class::Storage::DBI::SQLite::BEGIN@10 # spent 37µs making 1 call to Exporter::import
113629µs2350µs
# spent 179µs (8+171) within DBIx::Class::Storage::DBI::SQLite::BEGIN@11 which was called: # once (8µs+171µs) by Class::C3::Componentised::ensure_class_loaded at line 11
use namespace::clean;
# spent 179µs making 1 call to DBIx::Class::Storage::DBI::SQLite::BEGIN@11 # spent 171µs making 1 call to namespace::clean::import
12
13110µs146µs__PACKAGE__->sql_maker_class('DBIx::Class::SQLMaker::SQLite');
# spent 46µs making 1 call to DBIx::Class::Storage::DBI::sql_maker_class
1415µs114µs__PACKAGE__->sql_limit_dialect ('LimitOffset');
# spent 14µs making 1 call to DBIx::Class::Storage::DBI::sql_limit_dialect
1515µs112µs__PACKAGE__->sql_quote_char ('"');
# spent 12µs making 1 call to DBIx::Class::Storage::DBI::sql_quote_char
1614µs14µs__PACKAGE__->datetime_parser_type ('DateTime::Format::SQLite');
17
18sub backup {
19
20 require File::Spec;
21 require File::Copy;
22 require POSIX;
23
24 my ($self, $dir) = @_;
25 $dir ||= './';
26
27 ## Where is the db file?
28 my $dsn = $self->_dbi_connect_info()->[0];
29
30 my $dbname = $1 if($dsn =~ /dbname=([^;]+)/);
31 if(!$dbname)
32 {
33 $dbname = $1 if($dsn =~ /^dbi:SQLite:(.+)$/i);
34 }
35 $self->throw_exception("Cannot determine name of SQLite db file")
36 if(!$dbname || !-f $dbname);
37
38# print "Found database: $dbname\n";
39# my $dbfile = file($dbname);
40 my ($vol, $dbdir, $file) = File::Spec->splitpath($dbname);
41# my $file = $dbfile->basename();
42 $file = POSIX::strftime("%Y-%m-%d-%H_%M_%S", localtime()) . $file;
43 $file = "B$file" while(-f $file);
44
45 mkdir($dir) unless -f $dir;
46 my $backupfile = File::Spec->catfile($dir, $file);
47
48 my $res = File::Copy::copy($dbname, $backupfile);
49 $self->throw_exception("Backup failed! ($!)") if(!$res);
50
51 return $backupfile;
52}
53
54sub _exec_svp_begin {
55 my ($self, $name) = @_;
56
57 $self->_dbh->do("SAVEPOINT $name");
58}
59
60sub _exec_svp_release {
61 my ($self, $name) = @_;
62
63 $self->_dbh->do("RELEASE SAVEPOINT $name");
64}
65
66sub _exec_svp_rollback {
67 my ($self, $name) = @_;
68
69 # For some reason this statement changes the value of $dbh->{AutoCommit}, so
70 # we localize it here to preserve the original value.
71 local $self->_dbh->{AutoCommit} = $self->_dbh->{AutoCommit};
72
73 $self->_dbh->do("ROLLBACK TRANSACTION TO SAVEPOINT $name");
74}
75
76
# spent 254ms (115µs+254) within DBIx::Class::Storage::DBI::SQLite::deployment_statements which was called 4 times, avg 63.4ms/call: # 2 times (61µs+247ms) by DBIx::Class::Schema::deployment_statements at line 128 of DBIx/Class/Storage/DBI.pm, avg 123ms/call # 2 times (54µs+7.03ms) by DBIx::Class::Schema::deployment_statements at line 1144 of DBIx/Class/Schema.pm, avg 3.54ms/call
sub deployment_statements {
772074µs my $self = shift;
78 my ($schema, $type, $version, $dir, $sqltargs, @rest) = @_;
79
80 $sqltargs ||= {};
81
82419µs if (
# spent 19µs making 4 calls to DBIx::Class::Storage::DBI::_server_info, avg 5µs/call
83 ! exists $sqltargs->{producer_args}{sqlite_version}
84 and
85 my $dver = $self->_server_info->{normalized_dbms_version}
86 ) {
87 $sqltargs->{producer_args}{sqlite_version} = $dver;
88 }
89
90450µs $self->next::method($schema, $type, $version, $dir, $sqltargs, @rest);
# spent 50µs making 4 calls to next::method, avg 13µs/call
91}
92
93
# spent 185µs (131+54) within DBIx::Class::Storage::DBI::SQLite::bind_attribute_by_data_type which was called 14 times, avg 13µs/call: # 14 times (131µs+54µs) by DBIx::Class::Storage::DBI::_dbi_attrs_for_bind at line 1535 of DBIx/Class/Storage/DBI.pm, avg 13µs/call
sub bind_attribute_by_data_type {
94 $_[1] =~ /^ (?: int(?:eger)? | (?:tiny|small|medium)int ) $/ix
9528210µs2154µs ? do { require DBI; DBI::SQL_INTEGER() }
# spent 38µs making 14 calls to DBIx::Class::Storage::DBI::SQLite::CORE:match, avg 3µs/call # spent 16µs making 7 calls to DBI::SQL_INTEGER, avg 2µs/call
96 : undef
97 ;
98}
99
100# DBD::SQLite (at least up to version 1.31 has a bug where it will
101# non-fatally nummify a string value bound as an integer, resulting
102# in insertions of '0' into supposed-to-be-numeric fields
103# Since this can result in severe data inconsistency, remove the
104# bind attr if such a sitation is detected
105#
106# FIXME - when a DBD::SQLite version is released that eventually fixes
107# this sutiation (somehow) - no-op this override once a proper DBD
108# version is detected
109
# spent 456ms (208+249) within DBIx::Class::Storage::DBI::SQLite::_dbi_attrs_for_bind which was called 8019 times, avg 57µs/call: # 8019 times (208ms+249ms) by DBIx::Class::Storage::DBI::_execute at line 1558 of DBIx/Class/Storage/DBI.pm, avg 57µs/call
sub _dbi_attrs_for_bind {
1103207672.3ms my ($self, $ident, $bind) = @_;
111801964.0ms my $bindattrs = $self->next::method($ident, $bind);
# spent 64.0ms making 8019 calls to next::method, avg 8µs/call
112
113 for (0.. $#$bindattrs) {
11411158136ms1797842.7ms if (
# spent 21.9ms making 8989 calls to DBI::SQL_INTEGER, avg 2µs/call # spent 20.8ms making 8989 calls to Scalar::Util::looks_like_number, avg 2µs/call
115 defined $bindattrs->[$_]
116 and
117 defined $bind->[$_][1]
118 and
119 $bindattrs->[$_] eq DBI::SQL_INTEGER()
120 and
121 ! looks_like_number ($bind->[$_][1])
122 ) {
123 carp_unique( sprintf (
124 "Non-numeric value supplied for column '%s' despite the numeric datatype",
125 $bind->[$_][0]{dbic_colname} || "# $_"
126 ) );
127 undef $bindattrs->[$_];
128 }
129 }
130
131 return $bindattrs;
132}
133
134=head2 connect_call_use_foreign_keys
135
136Used as:
137
138 on_connect_call => 'use_foreign_keys'
139
140In L<connect_info|DBIx::Class::Storage::DBI/connect_info> to turn on foreign key
141(including cascading) support for recent versions of SQLite and L<DBD::SQLite>.
142
143Executes:
144
145 PRAGMA foreign_keys = ON
146
147See L<http://www.sqlite.org/foreignkeys.html> for more information.
148
149=cut
150
151sub connect_call_use_foreign_keys {
152 my $self = shift;
153
154 $self->_do_query(
155 'PRAGMA foreign_keys = ON'
156 );
157}
158
15914µs1;
160
161=head1 NAME
162
163DBIx::Class::Storage::DBI::SQLite - Automatic primary key class for SQLite
164
165=head1 SYNOPSIS
166
167 # In your table classes
168 use base 'DBIx::Class::Core';
169 __PACKAGE__->set_primary_key('id');
170
171=head1 DESCRIPTION
172
173This class implements autoincrements for SQLite.
174
175=head1 AUTHORS
176
177Matt S. Trout <mst@shadowcatsystems.co.uk>
178
179=head1 LICENSE
180
181You may distribute this code under the same terms as Perl itself.
182
18318µs1362µs=cut
 
# spent 38µs within DBIx::Class::Storage::DBI::SQLite::CORE:match which was called 14 times, avg 3µs/call: # 14 times (38µs+0s) by DBIx::Class::Storage::DBI::SQLite::bind_attribute_by_data_type at line 95, avg 3µs/call
sub DBIx::Class::Storage::DBI::SQLite::CORE:match; # opcode
# spent 3µs within DBIx::Class::Storage::DBI::SQLite::_conn_pid which was called 3 times, avg 900ns/call: # once (2µs+0s) by DBIx::Class::Storage::DBI::_populate_dbh at line 1010 of DBIx/Class/Storage/DBI.pm # once (700ns+0s) by DBIx::Class::Storage::DBI::_verify_pid at line 242 of DBIx/Class/Storage/DBI.pm # once (500ns+0s) by DBIx::Class::Storage::DBI::_verify_pid at line 781 of Class/Accessor/Grouped.pm
sub DBIx::Class::Storage::DBI::SQLite::_conn_pid; # xsub
# spent 11µs (10+1) within DBIx::Class::Storage::DBI::SQLite::_dbh_autocommit which was called 6 times, avg 2µs/call: # 2 times (2µs+0s) by DBIx::Class::Storage::DBI::txn_commit at line 1361 of DBIx/Class/Storage/DBI.pm, avg 1µs/call # once (5µs+1µs) by DBIx::Class::Storage::DBI::_connect at line 1308 of DBIx/Class/Storage/DBI.pm # once (2µs+0s) by DBIx::Class::Storage::DBI::txn_begin at line 1317 of DBIx/Class/Storage/DBI.pm # once (600ns+0s) by DBIx::Class::Storage::DBI::_populate_dbh at line 1016 of DBIx/Class/Storage/DBI.pm # once (500ns+0s) by DBIx::Class::Storage::DBI::_connect at line 781 of Class/Accessor/Grouped.pm
sub DBIx::Class::Storage::DBI::SQLite::_dbh_autocommit; # xsub
# spent 9µs within DBIx::Class::Storage::DBI::SQLite::debug which was called 5 times, avg 2µs/call: # once (5µs+0s) by DBIx::Class::Storage::DBI::_query_end at line 1496 of DBIx/Class/Storage/DBI.pm # once (2µs+0s) by DBIx::Class::Storage::DBI::_query_start at line 1489 of DBIx/Class/Storage/DBI.pm # once (2µs+0s) by DBIx::Class::Storage::txn_begin at line 274 of DBIx/Class/Storage.pm # once (1µs+0s) by DBIx::Class::Storage::txn_commit at line 298 of DBIx/Class/Storage.pm # once (500ns+0s) by DBIx::Class::Storage::DBI::_query_start at line 781 of Class/Accessor/Grouped.pm
sub DBIx::Class::Storage::DBI::SQLite::debug; # xsub
# spent 2µs within DBIx::Class::Storage::DBI::SQLite::disable_sth_caching which was called 2 times, avg 800ns/call: # once (1µs+0s) by DBIx::Class::Storage::DBI::_dbh_sth at line 2252 of DBIx/Class/Storage/DBI.pm # once (500ns+0s) by DBIx::Class::Storage::DBI::_dbh_sth at line 781 of Class/Accessor/Grouped.pm
sub DBIx::Class::Storage::DBI::SQLite::disable_sth_caching; # xsub
# spent 2µs within DBIx::Class::Storage::DBI::SQLite::on_connect_call which was called 2 times, avg 800ns/call: # once (1µs+0s) by DBIx::Class::Storage::DBI::_run_connection_actions at line 1025 of DBIx/Class/Storage/DBI.pm # once (400ns+0s) by DBIx::Class::Storage::DBI::_run_connection_actions at line 781 of Class/Accessor/Grouped.pm
sub DBIx::Class::Storage::DBI::SQLite::on_connect_call; # xsub
# spent 1µs within DBIx::Class::Storage::DBI::SQLite::on_connect_do which was called 2 times, avg 700ns/call: # once (900ns+0s) by DBIx::Class::Storage::DBI::_parse_connect_do at line 725 of DBIx/Class/Storage/DBI.pm # once (500ns+0s) by DBIx::Class::Storage::DBI::_parse_connect_do at line 781 of Class/Accessor/Grouped.pm
sub DBIx::Class::Storage::DBI::SQLite::on_connect_do; # xsub
# spent 9µs within DBIx::Class::Storage::DBI::SQLite::transaction_depth which was called 5 times, avg 2µs/call: # once (5µs+0s) by DBIx::Class::Storage::DBI::txn_commit at line 1361 of DBIx/Class/Storage/DBI.pm # once (2µs+0s) by DBIx::Class::Storage::txn_begin at line 273 of DBIx/Class/Storage.pm # once (1µs+0s) by DBIx::Class::Storage::DBI::txn_commit at line 1351 of DBIx/Class/Storage/DBI.pm # once (700ns+0s) by DBIx::Class::Storage::txn_commit at line 297 of DBIx/Class/Storage.pm # once (500ns+0s) by DBIx::Class::Storage::txn_begin at line 781 of Class/Accessor/Grouped.pm
sub DBIx::Class::Storage::DBI::SQLite::transaction_depth; # xsub
# spent 2µs within DBIx::Class::Storage::DBI::SQLite::unsafe which was called 2 times, avg 1µs/call: # once (2µs+0s) by DBIx::Class::Storage::DBI::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DBIx/Class/Storage/DBI.pm:1300] at line 1256 of DBIx/Class/Storage/DBI.pm # once (500ns+0s) by DBIx::Class::Storage::DBI::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DBIx/Class/Storage/DBI.pm:1300] at line 781 of Class/Accessor/Grouped.pm
sub DBIx::Class::Storage::DBI::SQLite::unsafe; # xsub