← 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:26 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Try/Tiny.pm
StatementsExecuted 502942 statements in 557ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
268883518470ms133sTry::Tiny::::try Try::Tiny::try (recurses: max depth 3, inclusive time 8.06s)
13950201488.6ms88.6msTry::Tiny::::catch Try::Tiny::catch
61154µs54µsTry::Tiny::::finally Try::Tiny::finally
61151µs62µsTry::Tiny::ScopeGuard::::DESTROYTry::Tiny::ScopeGuard::DESTROY
61126µs26µsTry::Tiny::ScopeGuard::::_newTry::Tiny::ScopeGuard::_new
11111µs15µsTry::Tiny::::BEGIN@3 Try::Tiny::BEGIN@3
11111µs11µsTry::Tiny::::BEGIN@8 Try::Tiny::BEGIN@8
1117µs54µsTry::Tiny::::BEGIN@46 Try::Tiny::BEGIN@46
1116µs72µsTry::Tiny::::BEGIN@6 Try::Tiny::BEGIN@6
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Try::Tiny;
2
3322µs218µs
# spent 15µs (11+4) within Try::Tiny::BEGIN@3 which was called: # once (11µs+4µs) by Module::Implementation::BEGIN@10 at line 3
use strict;
# spent 15µs making 1 call to Try::Tiny::BEGIN@3 # spent 4µs making 1 call to strict::import
4#use warnings;
5
6328µs2138µs
# spent 72µs (6+66) within Try::Tiny::BEGIN@6 which was called: # once (6µs+66µs) by Module::Implementation::BEGIN@10 at line 6
use vars qw(@EXPORT @EXPORT_OK $VERSION @ISA);
# spent 72µs making 1 call to Try::Tiny::BEGIN@6 # spent 66µs making 1 call to vars::import
7
8
# spent 11µs within Try::Tiny::BEGIN@8 which was called: # once (11µs+0s) by Module::Implementation::BEGIN@10 at line 11
BEGIN {
91400ns require Exporter;
10111µs @ISA = qw(Exporter);
11195µs111µs}
# spent 11µs making 1 call to Try::Tiny::BEGIN@8
12
131500ns$VERSION = "0.11";
14
15112µs$VERSION = eval $VERSION;
# spent 2µs executing statements in string eval
16
1712µs@EXPORT = @EXPORT_OK = qw(try catch finally);
18
1911µs$Carp::Internal{+__PACKAGE__}++;
20
21# Need to prototype as @ not $$ because of the way Perl evaluates the prototype.
22# Keeping it at $$ means you only ever get 1 sub because we need to eval in a list
23# context & not a scalar one
24
25
# spent 133s (470ms+132) within Try::Tiny::try which was called 26888 times, avg 4.94ms/call: # 9274 times (234ms+124s) by DBIx::Class::Storage::DBI::dbh_do at line 800 of DBIx/Class/Storage/DBI.pm, avg 13.3ms/call # 5708 times (74.3ms+344ms) by DBIx::Class::ResultSource::resultset at line 1039 of DBIx/Class/ResultSource.pm, avg 73µs/call # 4155 times (40.3ms+27.9ms) by DBIx::Class::ResultSource::related_source at line 1853 of DBIx/Class/ResultSource.pm, avg 16µs/call # 3531 times (55.0ms+147ms) by DBIx::Class::Relationship::Base::related_resultset at line 429 of DBIx/Class/Relationship/Base.pm, avg 57µs/call # 2100 times (30.4ms+18.4ms) by DBIx::Class::Storage::DBI::Cursor::DESTROY at line 181 of DBIx/Class/Storage/DBI/Cursor.pm, avg 23µs/call # 357 times (6.94ms+12.5ms) by DBIx::Class::ResultSet::_build_unique_cond at line 860 of DBIx/Class/ResultSet.pm, avg 55µs/call # 296 times (8.42ms+5.91ms) by DBIx::Class::Storage::DBI::_dbh_last_insert_id at line 2358 of DBIx/Class/Storage/DBI.pm, avg 48µs/call # 210 times (1.68ms+10.7ms) by DBIx::Class::ResultSource::reverse_relationship_info at line 1395 of DBIx/Class/ResultSource.pm, avg 59µs/call # 210 times (1.49ms+939µs) by DBIx::Class::ResultSource::reverse_relationship_info at line 1397 of DBIx/Class/ResultSource.pm, avg 12µs/call # 197 times (2.25ms+31.1ms) by Class::MOP::Attribute::_process_accessors at line 401 of Class/MOP/Attribute.pm, avg 169µs/call # 147 times (1.81ms+37.4ms) by DBIx::Class::InflateColumn::DateTime::_flate_or_fallback at line 207 of DBIx/Class/InflateColumn/DateTime.pm, avg 267µs/call # 131 times (1.58ms+45.6ms) by Class::MOP::Class::_post_add_attribute at line 896 of Class/MOP/Class.pm, avg 360µs/call # 76 times (753µs+1.27ms) by DBIx::Class::Schema::_ns_get_rsrc_instance at line 208 of DBIx/Class/Schema.pm, avg 27µs/call # 71 times (5.27ms+7.94s) 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:2767] at line 2765 of DBIx/Class/Storage/DBI.pm, avg 112ms/call # 60 times (690µs+3.92ms) by SQL::Translator::Parser::DBIx::Class::parse at line 154 of SQL/Translator/Parser/DBIx/Class.pm, avg 77µs/call # 60 times (487µs+3.12ms) by DBIx::Class::ResultSource::reverse_relationship_info at line 1382 of DBIx/Class/ResultSource.pm, avg 60µs/call # 60 times (477µs+290µs) by DBIx::Class::ResultSource::reverse_relationship_info at line 1378 of DBIx/Class/ResultSource.pm, avg 13µs/call # 56 times (709µs+-709µs) by Class::MOP::Method::Accessor::_generate_reader_method_inline at line 157 of Class/MOP/Method/Accessor.pm, avg 0s/call # 37 times (310µs+529µs) by DBIx::Class::Schema::_register_source at line 1378 of DBIx/Class/Schema.pm, avg 23µs/call # 30 times (539µs+18.8ms) by Class::MOP::Method::Constructor::_generate_constructor_method_inline at line 115 of Class/MOP/Method/Constructor.pm, avg 645µs/call # 28 times (397µs+-397µs) by Class::MOP::Method::Accessor::_generate_accessor_method_inline at line 123 of Class/MOP/Method/Accessor.pm, avg 0s/call # 26 times (641µs+6.23ms) by DBIx::Class::ResultSet::find at line 793 of DBIx/Class/ResultSet.pm, avg 264µs/call # 16 times (187µs+-187µs) by Class::MOP::Method::Accessor::_generate_predicate_method_inline at line 212 of Class/MOP/Method/Accessor.pm, avg 0s/call # 9 times (142µs+-142µs) by Moose::Meta::Method::Accessor::_compile_code at line 47 of Moose/Meta/Method/Accessor.pm, avg 0s/call # 6 times (137µs+99.8ms) by Class::Load::try_load_class at line 183 of Class/Load.pm, avg 16.6ms/call # 6 times (108µs+22.4ms) by DBIx::Class::Schema::connection at line 834 of DBIx/Class/Schema.pm, avg 3.76ms/call # 6 times (238µs+259µs) by DBIx::Class::Storage::DBI::_connect at line 1306 of DBIx/Class/Storage/DBI.pm, avg 83µs/call # 5 times (394µs+59.9ms) by DBIx::Class::Schema::Versioned::get_db_version at line 533 of DBIx/Class/Schema/Versioned.pm, avg 12.1ms/call # 4 times (60µs+18.0ms) by DBIx::Class::Storage::DBI::_server_info at line 1078 of DBIx/Class/Storage/DBI.pm, avg 4.52ms/call # 4 times (50µs+-50µs) by DBIx::Class::Storage::DBI::_dbh_get_info at line 1116 of DBIx/Class/Storage/DBI.pm, avg 0s/call # 3 times (109µs+187µs) by Moose::Object::DESTROY at line 102 of Moose/Object.pm, avg 99µs/call # 3 times (125µs+152µs) by DBIx::Class::Row::_is_column_numeric at line 794 of DBIx/Class/Row.pm, avg 92µs/call # 3 times (36µs+-36µs) by Class::MOP::Method::Accessor::_generate_writer_method_inline at line 187 of Class/MOP/Method/Accessor.pm, avg 0s/call # 2 times (39µs+1.08ms) by Module::Implementation::_load_implementation at line 90 of Module/Implementation.pm, avg 562µs/call # once (16µs+2.73ms) by DBIx::Class::Schema::Versioned::_source_exists at line 754 of DBIx/Class/Schema/Versioned.pm
sub try (&;@) {
262688821.2ms my ( $try, @code_refs ) = @_;
27
28 # we need to save this here, the eval block will be in scalar context due
29 # to $failed
302688813.7ms my $wantarray = wantarray;
31
322688811.7ms my ( $catch, @finally );
33
34 # find labeled blocks in the argument list.
35 # catch and finally tag the blocks by blessing a scalar reference to them.
362688828.0ms foreach my $code_ref (@code_refs) {
37139564.35ms next unless $code_ref;
38
391395612.3ms my $ref = ref($code_ref);
40
411395625.6ms if ( $ref eq 'Try::Tiny::Catch' ) {
42 $catch = ${$code_ref};
43 } elsif ( $ref eq 'Try::Tiny::Finally' ) {
44 push @finally, ${$code_ref};
45 } else {
463264µs2101µs
# spent 54µs (7+47) within Try::Tiny::BEGIN@46 which was called: # once (7µs+47µs) by Module::Implementation::BEGIN@10 at line 46
use Carp;
# spent 54µs making 1 call to Try::Tiny::BEGIN@46 # spent 47µs making 1 call to Exporter::import
47 confess("Unknown code ref type given '${ref}'. Check your usage & try again");
48 }
49 }
50
51 # save the value of $@ so we can set $@ back to it in the beginning of the eval
522688812.7ms my $prev_error = $@;
53
54268888.89ms my ( @ret, $error, $failed );
55
56 # FIXME consider using local $SIG{__DIE__} to accumulate all errors. It's
57 # not perfect, but we could provide a list of additional errors for
58 # $catch->();
59
60 {
61 # localize $@ to prevent clobbering of previous value by a successful
62 # eval.
635377622.5ms local $@;
64
65 # failed will be true if the eval dies, because 1 will not be returned
66 # from the eval body
672688834.8ms $failed = not eval {
68268888.58ms $@ = $prev_error;
69
70 # evaluate the try block in the correct context
712688868.9ms23987122s if ( $wantarray ) {
# spent 121s making 8889 calls to DBIx::Class::Storage::DBI::__ANON__[DBIx/Class/Storage/DBI.pm:790], avg 13.7ms/call # spent 344ms making 5708 calls to DBIx::Class::ResultSource::__ANON__[DBIx/Class/ResultSource.pm:1038], avg 60µs/call # spent 147ms making 3531 calls to DBIx::Class::Relationship::Base::__ANON__[DBIx/Class/Relationship/Base.pm:422], avg 42µs/call # spent 99.8ms making 6 calls to Class::Load::__ANON__[Class/Load.pm:180], avg 16.6ms/call # spent 59.7ms making 5 calls to DBIx::Class::Schema::Versioned::__ANON__[DBIx/Class/Schema/Versioned.pm:533], avg 11.9ms/call # spent 37.4ms making 147 calls to DBIx::Class::InflateColumn::DateTime::__ANON__[DBIx/Class/InflateColumn/DateTime.pm:202], avg 254µs/call # spent 31.9ms making 4155 calls to DBIx::Class::ResultSource::__ANON__[DBIx/Class/ResultSource.pm:1853], avg 8µs/call # spent 18.8ms making 30 calls to Class::MOP::Method::Constructor::__ANON__[Class/MOP/Method/Constructor.pm:111], avg 627µs/call # spent 18.0ms making 4 calls to DBIx::Class::Storage::DBI::__ANON__[DBIx/Class/Storage/DBI.pm:1078], avg 4.50ms/call # spent 17.9ms making 4 calls to DBIx::Class::Storage::DBI::__ANON__[DBIx/Class/Storage/DBI.pm:1116], avg 4.47ms/call # spent 16.2ms making 357 calls to DBIx::Class::ResultSet::__ANON__[DBIx/Class/ResultSet.pm:858], avg 45µs/call # spent 14.6ms making 56 calls to Class::MOP::Method::Accessor::__ANON__[Class/MOP/Method/Accessor.pm:154], avg 261µs/call # spent 12.9ms making 28 calls to Class::MOP::Method::Accessor::__ANON__[Class/MOP/Method/Accessor.pm:120], avg 461µs/call # spent 10.7ms making 210 calls to DBIx::Class::ResultSource::__ANON__[DBIx/Class/ResultSource.pm:1394], avg 51µs/call # spent 6.23ms making 26 calls to DBIx::Class::ResultSet::__ANON__[DBIx/Class/ResultSet.pm:793], avg 240µs/call # spent 5.91ms making 296 calls to DBIx::Class::Storage::DBI::__ANON__[DBIx/Class/Storage/DBI.pm:2358], avg 20µs/call # spent 3.92ms making 60 calls to SQL::Translator::Parser::DBIx::Class::__ANON__[SQL/Translator/Parser/DBIx/Class.pm:154], avg 65µs/call # spent 3.72ms making 9 calls to Moose::Meta::Method::Accessor::__ANON__[Moose/Meta/Method/Accessor.pm:39], avg 414µs/call # spent 3.12ms making 60 calls to DBIx::Class::ResultSource::__ANON__[DBIx/Class/ResultSource.pm:1381], avg 52µs/call # spent 2.73ms making 1 call to DBIx::Class::Schema::Versioned::__ANON__[DBIx/Class/Schema/Versioned.pm:752] # spent 2.54ms making 16 calls to Class::MOP::Method::Accessor::__ANON__[Class/MOP/Method/Accessor.pm:209], avg 159µs/call # spent 1.27ms making 76 calls to DBIx::Class::Schema::__ANON__[DBIx/Class/Schema.pm:204], avg 17µs/call # spent 939µs making 210 calls to DBIx::Class::ResultSource::__ANON__[DBIx/Class/ResultSource.pm:1397], avg 4µs/call # spent 529µs making 37 calls to DBIx::Class::Schema::__ANON__[DBIx/Class/Schema.pm:1378], avg 14µs/call # spent 480µs making 3 calls to Class::MOP::Method::Accessor::__ANON__[Class/MOP/Method/Accessor.pm:184], avg 160µs/call # spent 290µs making 60 calls to DBIx::Class::ResultSource::__ANON__[DBIx/Class/ResultSource.pm:1378], avg 5µs/call # spent 152µs making 3 calls to DBIx::Class::Row::__ANON__[DBIx/Class/Row.pm:797], avg 51µs/call
72 @ret = $try->();
73 } elsif ( defined $wantarray ) {
74 $ret[0] = $try->();
75 } else {
7629015.54ms290118.2s $try->();
# spent 10.1s making 385 calls to DBIx::Class::Storage::DBI::__ANON__[DBIx/Class/Storage/DBI.pm:790], avg 26.2ms/call # spent 7.94s making 71 calls to DBIx::Class::Storage::DBI::__ANON__[DBIx/Class/Storage/DBI.pm:2763], avg 112ms/call # spent 53.2ms making 197 calls to Class::MOP::Attribute::__ANON__[Class/MOP/Attribute.pm:398], avg 270µs/call # spent 45.6ms making 131 calls to Class::MOP::Class::__ANON__[Class/MOP/Class.pm:892], avg 348µs/call # spent 22.4ms making 6 calls to DBIx::Class::Schema::__ANON__[DBIx/Class/Schema.pm:829], avg 3.74ms/call # spent 19.4ms making 6 calls to DBIx::Class::Storage::DBI::__ANON__[DBIx/Class/Storage/DBI.pm:1300], avg 3.23ms/call # spent 18.5ms making 2100 calls to DBIx::Class::Storage::DBI::Cursor::__ANON__[DBIx/Class/Storage/DBI/Cursor.pm:182], avg 9µs/call # spent 1.08ms making 2 calls to Module::Implementation::__ANON__[Module/Implementation.pm:87], avg 542µs/call # spent 186µs making 3 calls to Moose::Object::__ANON__[Moose/Object.pm:99], avg 62µs/call
77 };
78
792688417.3ms3186µs return 1; # properly set $fail to false
# spent 186µs making 3 calls to DBIx::Class::Storage::DBI::Cursor::DESTROY, avg 62µs/call
80 };
81
82 # copy $@ to $error; when we leave this scope, local $@ will revert $@
83 # back to its previous value
842688818.2ms216µs $error = $@;
# spent 16µs making 2 calls to DBIx::Class::Storage::DBI::Cursor::DESTROY, avg 8µs/call
85 }
86
87 # set up a scope guard to invoke the finally block at the end
88632µs626µs my @guards =
# spent 26µs making 6 calls to Try::Tiny::ScopeGuard::_new, avg 4µs/call
892688819.2ms map { Try::Tiny::ScopeGuard->_new($_, $failed ? $error : ()) }
90 @finally;
91
92 # at this point $failed contains a true value if the eval died, even if some
93 # destructor overwrote $@ as the eval was unwinding.
94268888.99ms if ( $failed ) {
95 # if we got an error, invoke the catch block.
9643µs if ( $catch ) {
97 # This works like given($error), but is backwards compatible and
98 # sets $_ in the dynamic scope for the body of C<$catch>
99 for ($error) {
10025µs2357µs return $catch->($error);
# spent 357µs making 2 calls to DBIx::Class::Storage::DBI::__ANON__[DBIx/Class/Storage/DBI.pm:800], avg 178µs/call
101 }
102
103 # in case when() was used without an explicit return, the C<for>
104 # loop will be aborted and there's no useful return value
105 }
106
107210µs return;
108 } else {
109 # no failure, $@ is back to what it was, everything is fine
11026884107ms return $wantarray ? @ret : $ret[0];
111 }
112}
113
114
# spent 88.6ms within Try::Tiny::catch which was called 13950 times, avg 6µs/call: # 9274 times (63.3ms+0s) by DBIx::Class::Storage::DBI::dbh_do at line 800 of DBIx/Class/Storage/DBI.pm, avg 7µs/call # 3531 times (19.8ms+0s) by DBIx::Class::Relationship::Base::related_resultset at line 429 of DBIx/Class/Relationship/Base.pm, avg 6µs/call # 357 times (2.29ms+0s) by DBIx::Class::ResultSet::_build_unique_cond at line 860 of DBIx/Class/ResultSet.pm, avg 6µs/call # 197 times (536µs+0s) by Class::MOP::Attribute::_process_accessors at line 401 of Class/MOP/Attribute.pm, avg 3µs/call # 147 times (408µs+0s) by DBIx::Class::InflateColumn::DateTime::_flate_or_fallback at line 207 of DBIx/Class/InflateColumn/DateTime.pm, avg 3µs/call # 131 times (444µs+0s) by Class::MOP::Class::_post_add_attribute at line 896 of Class/MOP/Class.pm, avg 3µs/call # 76 times (185µs+0s) by DBIx::Class::Schema::_ns_get_rsrc_instance at line 208 of DBIx/Class/Schema.pm, avg 2µs/call # 71 times (1.13ms+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:2767] at line 2765 of DBIx/Class/Storage/DBI.pm, avg 16µs/call # 56 times (130µs+0s) by Class::MOP::Method::Accessor::_generate_reader_method_inline at line 157 of Class/MOP/Method/Accessor.pm, avg 2µs/call # 30 times (140µs+0s) by Class::MOP::Method::Constructor::_generate_constructor_method_inline at line 115 of Class/MOP/Method/Constructor.pm, avg 5µs/call # 28 times (68µs+0s) by Class::MOP::Method::Accessor::_generate_accessor_method_inline at line 123 of Class/MOP/Method/Accessor.pm, avg 2µs/call # 16 times (36µs+0s) by Class::MOP::Method::Accessor::_generate_predicate_method_inline at line 212 of Class/MOP/Method/Accessor.pm, avg 2µs/call # 9 times (28µs+0s) by Moose::Meta::Method::Accessor::_compile_code at line 47 of Moose/Meta/Method/Accessor.pm, avg 3µs/call # 6 times (43µs+0s) by Class::Load::try_load_class at line 183 of Class/Load.pm, avg 7µs/call # 6 times (33µs+0s) by DBIx::Class::Schema::connection at line 834 of DBIx/Class/Schema.pm, avg 5µs/call # 6 times (30µs+0s) by DBIx::Class::Storage::DBI::_connect at line 1306 of DBIx/Class/Storage/DBI.pm, avg 5µs/call # 3 times (30µs+0s) by Moose::Object::DESTROY at line 102 of Moose/Object.pm, avg 10µs/call # 3 times (6µs+0s) by Class::MOP::Method::Accessor::_generate_writer_method_inline at line 187 of Class/MOP/Method/Accessor.pm, avg 2µs/call # 2 times (22µs+0s) by Module::Implementation::_load_implementation at line 90 of Module/Implementation.pm, avg 11µs/call # once (2µs+0s) by DBIx::Class::Schema::Versioned::_source_exists at line 754 of DBIx/Class/Schema/Versioned.pm
sub catch (&;@) {
1151395012.8ms my ( $block, @rest ) = @_;
116
117 return (
1181395094.3ms bless(\$block, 'Try::Tiny::Catch'),
119 @rest,
120 );
121}
122
123
# spent 54µs within Try::Tiny::finally which was called 6 times, avg 9µs/call: # 6 times (54µs+0s) by DBIx::Class::Storage::DBI::_connect at line 1306 of DBIx/Class/Storage/DBI.pm, avg 9µs/call
sub finally (&;@) {
12466µs my ( $block, @rest ) = @_;
125
126 return (
127662µs bless(\$block, 'Try::Tiny::Finally'),
128 @rest,
129 );
130}
131
132{
1331700ns package # hide from PAUSE
134 Try::Tiny::ScopeGuard;
135
136
# spent 26µs within Try::Tiny::ScopeGuard::_new which was called 6 times, avg 4µs/call: # 6 times (26µs+0s) by Try::Tiny::try at line 88, avg 4µs/call
sub _new {
13763µs shift;
138634µs bless [ @_ ];
139 }
140
141
# spent 62µs (51+11) within Try::Tiny::ScopeGuard::DESTROY which was called 6 times, avg 10µs/call: # 6 times (51µs+11µs) by Try::Tiny::try at line 1306 of DBIx/Class/Storage/DBI.pm, avg 10µs/call
sub DESTROY {
142612µs my @guts = @{ shift() };
14364µs my $code = shift @guts;
144629µs611µs $code->(@guts);
# spent 11µs making 6 calls to DBIx::Class::Storage::DBI::__ANON__[DBIx/Class/Storage/DBI.pm:1306], avg 2µs/call
145 }
146}
147
148__PACKAGE__
149
15014µs__END__