← 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:22:34 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Devel/GlobalDestruction.pm
StatementsExecuted 15 statements in 401µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
31115µs15µsDevel::GlobalDestruction::::in_global_destructionDevel::GlobalDestruction::in_global_destruction (xsub)
11113µs15µsDevel::GlobalDestruction::::BEGIN@3Devel::GlobalDestruction::BEGIN@3
11112µs399µsDevel::GlobalDestruction::::BEGIN@8Devel::GlobalDestruction::BEGIN@8
1116µs13µsDevel::GlobalDestruction::::BEGIN@4Devel::GlobalDestruction::BEGIN@4
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Devel::GlobalDestruction;
2
3316µs217µs
# spent 15µs (13+2) within Devel::GlobalDestruction::BEGIN@3 which was called: # once (13µs+2µs) by Class::MOP::Package::BEGIN@15 at line 3
use strict;
# spent 15µs making 1 call to Devel::GlobalDestruction::BEGIN@3 # spent 2µs making 1 call to strict::import
4337µs221µs
# spent 13µs (6+7) within Devel::GlobalDestruction::BEGIN@4 which was called: # once (6µs+7µs) by Class::MOP::Package::BEGIN@15 at line 4
use warnings;
# spent 13µs making 1 call to Devel::GlobalDestruction::BEGIN@4 # spent 7µs making 1 call to warnings::import
5
61500nsour $VERSION = '0.05';
7
81388µs
# spent 399µs (12+388) within Devel::GlobalDestruction::BEGIN@8 which was called: # once (12µs+388µs) by Class::MOP::Package::BEGIN@15 at line 11
use Sub::Exporter -setup => {
# spent 388µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:756]
9 exports => [ qw(in_global_destruction) ],
10 groups => { default => [ -all ] },
11398µs1399µs};
# spent 399µs making 1 call to Devel::GlobalDestruction::BEGIN@8
12
131900nsif (defined ${^GLOBAL_PHASE}) {
14 eval 'sub in_global_destruction () { ${^GLOBAL_PHASE} eq q[DESTRUCT] }';
15}
16elsif (eval {
171600ns require XSLoader;
181240µs1234µs XSLoader::load(__PACKAGE__, $VERSION);
# spent 234µs making 1 call to XSLoader::load
191900ns 1;
20}) {
21 # the eval already installed everything, nothing to do
22}
23else {
24 eval <<'PP_IGD' or die $@;
25
26my ($in_global_destruction, $before_is_installed);
27
28sub in_global_destruction { $in_global_destruction }
29
30END {
31 # SpeedyCGI runs END blocks every cycle but somehow keeps object instances
32 # hence lying about it seems reasonable...ish
33 $in_global_destruction = 1 unless $CGI::SpeedyCGI::i_am_speedy;
34}
35
36# threads do not execute the global ENDs (it would be stupid). However
37# one can register a new END via simple string eval within a thread, and
38# achieve the same result. A logical place to do this would be CLONE, which
39# is claimed to run in the context of the new thread. However this does
40# not really seem to be the case - any END evaled in a CLONE is ignored :(
41# Hence blatantly hooking threads::create
42
43if ($INC{'threads.pm'}) {
44 my $orig_create = threads->can('create');
45 no warnings 'redefine';
46 *threads::create = sub {
47 { local $@; eval 'END { $in_global_destruction = 1 }' };
48 goto $orig_create;
49 };
50 $before_is_installed = 1;
51}
52
53# just in case threads got loaded after us (silly)
54sub CLONE {
55 unless ($before_is_installed) {
56 require Carp;
57 Carp::croak("You must load the 'threads' module before @{[ __PACKAGE__ ]}");
58 }
59}
60
611; # keep eval happy
62
63PP_IGD
64
65}
66
6717µs1; # keep require happy
68
69
70__END__
 
# spent 15µs within Devel::GlobalDestruction::in_global_destruction which was called 3 times, avg 5µs/call: # 3 times (15µs+0s) by Moose::Object::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Moose/Object.pm:99] at line 98 of Moose/Object.pm, avg 5µs/call
sub Devel::GlobalDestruction::in_global_destruction; # xsub