← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/pan_genome_post_analysis
  Run on Fri Mar 27 11:43:32 2015
Reported on Fri Mar 27 11:45:55 2015

Filename/Users/ap13/perl5/perlbrew/perls/perl-5.16.2/lib/5.16.2/base.pm
StatementsExecuted 2174 statements in 6.68ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
61616025.8ms75.4msbase::::importbase::import (recurses: max depth 3, inclusive time 30.6ms)
111674µs1.36msbase::::BEGIN@4base::BEGIN@4
8811315µs315µsbase::::has_fieldsbase::has_fields
8811234µs234µsbase::::has_attrbase::has_attr
11120µs38µsbase::::BEGIN@3base::BEGIN@3
0000s0sbase::::__ANON__[:48]base::__ANON__[:48]
0000s0sbase::::__ANON__[:55]base::__ANON__[:55]
0000s0sbase::::get_attrbase::get_attr
0000s0sbase::::inherit_fieldsbase::inherit_fields
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package base;
2
3246µs257µs
# spent 38µs (20+18) within base::BEGIN@3 which was called: # once (20µs+18µs) by Class::Load::BEGIN@7 at line 3
use strict 'vars';
# spent 38µs making 1 call to base::BEGIN@3 # spent 18µs making 1 call to strict::import
42998µs21.39ms
# spent 1.36ms (674µs+684µs) within base::BEGIN@4 which was called: # once (674µs+684µs) by Class::Load::BEGIN@7 at line 4
use vars qw($VERSION);
# spent 1.36ms making 1 call to base::BEGIN@4 # spent 35µs making 1 call to vars::import
511µs$VERSION = '2.18';
6124µs$VERSION = eval $VERSION;
# spent 2µs executing statements in string eval
7
8# constant.pm is slow
9sub SUCCESS () { 1 }
10
11sub PUBLIC () { 2**0 }
12sub PRIVATE () { 2**1 }
13sub INHERITED () { 2**2 }
14sub PROTECTED () { 2**3 }
15
16
171800nsmy $Fattr = \%fields::attr;
18
19
# spent 315µs within base::has_fields which was called 88 times, avg 4µs/call: # 88 times (315µs+0s) by base::import at line 101, avg 4µs/call
sub has_fields {
208848µs my($base) = shift;
218880µs my $fglob = ${"$base\::"}{FIELDS};
2288291µs return( ($fglob && 'GLOB' eq ref($fglob) && *$fglob{HASH}) ? 1 : 0 );
23}
24
25
# spent 234µs within base::has_attr which was called 88 times, avg 3µs/call: # 88 times (234µs+0s) by base::import at line 101, avg 3µs/call
sub has_attr {
268834µs my($proto) = shift;
278832µs my($class) = ref $proto || $proto;
2888206µs return exists $Fattr->{$class};
29}
30
31sub get_attr {
32 $Fattr->{$_[0]} = [1] unless $Fattr->{$_[0]};
33 return $Fattr->{$_[0]};
34}
35
3612µsif ($] < 5.009) {
37 *get_fields = sub {
38 # Shut up a possible typo warning.
39 () = \%{$_[0].'::FIELDS'};
40 my $f = \%{$_[0].'::FIELDS'};
41
42 # should be centralized in fields? perhaps
43 # fields::mk_FIELDS_be_OK. Peh. As long as %{ $package . '::FIELDS' }
44 # is used here anyway, it doesn't matter.
45 bless $f, 'pseudohash' if (ref($f) ne 'pseudohash');
46
47 return $f;
48 }
49}
50else {
51 *get_fields = sub {
52 # Shut up a possible typo warning.
53 () = \%{$_[0].'::FIELDS'};
54 return \%{$_[0].'::FIELDS'};
55 }
5613µs}
57
58
# spent 75.4ms (25.8+49.6) within base::import which was called 61 times, avg 1.24ms/call: # once (1.80ms+35.2ms) by Bio::Seq::SeqFactory::BEGIN@83 at line 83 of Bio/Seq/SeqFactory.pm # once (3.71ms+15.9ms) by Bio::LocatableSeq::BEGIN@120 at line 120 of Bio/LocatableSeq.pm # once (2.10ms+5.12ms) by Bio::SeqFeature::Generic::BEGIN@151 at line 151 of Bio/SeqFeature/Generic.pm # once (1.62ms+4.59ms) by Bio::Location::Simple::BEGIN@87 at line 87 of Bio/Location/Simple.pm # once (373µs+215µs) by Bio::Tools::GFF::BEGIN@154 at line 154 of Bio/Tools/GFF.pm # once (391µs+182µs) by Bio::Location::Split::BEGIN@101 at line 101 of Bio/Location/Split.pm # once (389µs+141µs) by Bio::Location::Fuzzy::BEGIN@84 at line 84 of Bio/Location/Fuzzy.pm # once (400µs+124µs) by Bio::Annotation::Collection::BEGIN@96 at line 96 of Bio/Annotation/Collection.pm # once (351µs+147µs) by Bio::Seq::SeqBuilder::BEGIN@133 at line 133 of Bio/Seq/SeqBuilder.pm # once (304µs+168µs) by Bio::Factory::FTLocationFactory::BEGIN@102 at line 102 of Bio/Factory/FTLocationFactory.pm # once (341µs+117µs) by Bio::Annotation::SimpleValue::BEGIN@82 at line 82 of Bio/Annotation/SimpleValue.pm # once (114µs+17µs) by Graph::Traversal::DFS::BEGIN@6 at line 6 of Graph/Traversal/DFS.pm # once (102µs+14µs) by Sub::Name::BEGIN@49 at line 49 of Sub/Name.pm # once (96µs+14µs) by Graph::AdjacencyMatrix::BEGIN@8 at line 8 of Graph/AdjacencyMatrix.pm # once (97µs+12µs) by Graph::SPTHeapElem::BEGIN@7 at line 7 of Graph/SPTHeapElem.pm # once (94µs+14µs) by Graph::MSTHeapElem::BEGIN@7 at line 7 of Graph/MSTHeapElem.pm # once (95µs+11µs) by Graph::Undirected::BEGIN@4 at line 4 of Graph/Undirected.pm # once (90µs+10µs) by Bio::Factory::SequenceStreamI::BEGIN@80 at line 80 of Bio/Factory/SequenceStreamI.pm # once (82µs+10µs) by Class::Load::BEGIN@7 at line 7 of Class/Load.pm # once (69µs+13µs) by Moose::Meta::TypeConstraint::BEGIN@18 at line 18 of Moose/Meta/TypeConstraint.pm # once (71µs+10µs) by Sub::Name::BEGIN@50 at line 50 of Sub/Name.pm # once (64µs+11µs) by Bio::Roary::Exceptions::FileNotFound::BEGIN@3 at line 3 of (eval 180)[Exception/Class.pm:179] # once (65µs+8µs) by Bio::Annotation::TypeManager::BEGIN@86 at line 86 of Bio/Annotation/TypeManager.pm # once (62µs+10µs) by Exception::Class::Base::BEGIN@10 at line 10 of Exception/Class/Base.pm # once (62µs+10µs) by Graph::AdjacencyMap::Heavy::BEGIN@13 at line 13 of Graph/AdjacencyMap/Heavy.pm # once (56µs+7µs) by Bio::Tools::GuessSeqFormat::BEGIN@251 at line 251 of Bio/Tools/GuessSeqFormat.pm # once (53µs+7µs) by Bio::Roary::Exceptions::CouldntWriteToFile::BEGIN@3 at line 3 of (eval 182)[Exception/Class.pm:179] # once (53µs+6µs) by Graph::TransitiveClosure::BEGIN@9 at line 9 of Graph/TransitiveClosure.pm # once (52µs+6µs) by Graph::AdjacencyMap::Light::BEGIN@10 at line 10 of Graph/AdjacencyMap/Light.pm # once (46µs+6µs) by Graph::AdjacencyMap::Vertex::BEGIN@13 at line 13 of Graph/AdjacencyMap/Vertex.pm # once (48µs+-48µs) by Bio::RangeI::BEGIN@96 at line 96 of Bio/RangeI.pm # once (522µs+-522µs) by Bio::Seq::BEGIN@464 at line 464 of Bio/Seq.pm # once (46µs+-46µs) by Bio::Factory::ObjectBuilderI::BEGIN@98 at line 98 of Bio/Factory/ObjectBuilderI.pm # once (2.48ms+-2.48ms) by Bio::LocationI::BEGIN@79 at line 79 of Bio/LocationI.pm # once (1.86ms+-1.86ms) by Bio::Root::Root::BEGIN@5 at line 5 of Bio/Root/Root.pm # once (61µs+-61µs) by Bio::AnnotationI::BEGIN@120 at line 120 of Bio/AnnotationI.pm # once (59µs+-59µs) by Bio::Factory::ObjectFactoryI::BEGIN@80 at line 80 of Bio/Factory/ObjectFactoryI.pm # once (53µs+-53µs) by Bio::PrimarySeqI::BEGIN@126 at line 126 of Bio/PrimarySeqI.pm # once (56µs+-56µs) by Bio::Location::SplitLocationI::BEGIN@84 at line 84 of Bio/Location/SplitLocationI.pm # once (3.69ms+-3.69ms) by Bio::PrimarySeq::BEGIN@133 at line 134 of Bio/PrimarySeq.pm # once (841µs+-841µs) by Bio::Location::Atomic::BEGIN@81 at line 81 of Bio/Location/Atomic.pm # once (75µs+-75µs) by Bio::IdentifiableI::BEGIN@96 at line 96 of Bio/IdentifiableI.pm # once (65µs+-65µs) by Bio::Tools::CodonTable::BEGIN@193 at line 193 of Bio/Tools/CodonTable.pm # once (55µs+-55µs) by Bio::SeqAnalysisParserI::BEGIN@93 at line 93 of Bio/SeqAnalysisParserI.pm # once (52µs+-52µs) by Bio::Location::CoordinatePolicyI::BEGIN@86 at line 86 of Bio/Location/CoordinatePolicyI.pm # once (795µs+-795µs) by Bio::SeqI::BEGIN@116 at line 116 of Bio/SeqI.pm # once (42µs+-42µs) by Bio::FeatureHolderI::BEGIN@98 at line 98 of Bio/FeatureHolderI.pm # once (66µs+-66µs) by Bio::Root::IO::BEGIN@8 at line 8 of Bio/Root/IO.pm # once (52µs+-52µs) by Bio::SeqFeatureI::BEGIN@109 at line 109 of Bio/SeqFeatureI.pm # once (64µs+-64µs) by Bio::Location::FuzzyLocationI::BEGIN@78 at line 78 of Bio/Location/FuzzyLocationI.pm # once (47µs+-47µs) by Bio::DB::RandomAccessI::BEGIN@68 at line 68 of Bio/DB/RandomAccessI.pm # once (53µs+-53µs) by Bio::Factory::LocationFactoryI::BEGIN@94 at line 94 of Bio/Factory/LocationFactoryI.pm # once (261µs+-261µs) by Bio::Factory::SequenceFactoryI::BEGIN@88 at line 88 of Bio/Factory/SequenceFactoryI.pm # once (319µs+-319µs) by Bio::DB::InMemoryCache::BEGIN@77 at line 77 of Bio/DB/InMemoryCache.pm # once (69µs+-69µs) by Bio::DescribableI::BEGIN@70 at line 70 of Bio/DescribableI.pm # once (101µs+-101µs) by Bio::Range::BEGIN@94 at line 94 of Bio/Range.pm # once (54µs+-54µs) by Bio::AnnotationCollectionI::BEGIN@137 at line 137 of Bio/AnnotationCollectionI.pm # once (306µs+-306µs) by Bio::Location::WidestCoordPolicy::BEGIN@80 at line 80 of Bio/Location/WidestCoordPolicy.pm # once (282µs+-282µs) by Bio::DB::SeqI::BEGIN@81 at line 81 of Bio/DB/SeqI.pm # once (65µs+-65µs) by Bio::Tools::IUPAC::BEGIN@169 at line 169 of Bio/Tools/IUPAC.pm # once (50µs+-50µs) by Bio::AnnotatableI::BEGIN@86 at line 86 of Bio/AnnotatableI.pm
sub import {
596136µs my $class = shift;
60
616122µs return SUCCESS unless @_;
62
63 # List of base classes from which we will inherit %FIELDS.
64619µs my $fields_base;
65
666162µs my $inheritor = caller(0);
67
686113µs my @bases;
696154µs foreach my $base (@_) {
709026µs if ( $inheritor eq $base ) {
71 warn "Class '$inheritor' tried to inherit from itself\n";
72 }
73
74901.02ms140224µs next if grep $_->isa($base), ($inheritor, @bases);
# spent 224µs making 140 calls to UNIVERSAL::isa, avg 2µs/call
75
76 # Following blocks help isolate $SIG{__DIE__} changes
77 {
7817630µs my $sigdie;
79 {
80176188µs local $SIG{__DIE__};
81881.54ms eval "require $base";
# spent 205µs executing statements in 2 string evals (merged) # spent 172µs executing statements in 2 string evals (merged) # spent 158µs executing statements in string eval # spent 145µs executing statements in string eval # spent 141µs executing statements in 2 string evals (merged) # spent 135µs executing statements in string eval # spent 134µs executing statements in 19 string evals (merged) # spent 131µs executing statements in 2 string evals (merged) # spent 131µs executing statements in 2 string evals (merged) # spent 130µs executing statements in 2 string evals (merged) # spent 128µs executing statements in 15 string evals (merged) # spent 122µs executing statements in 2 string evals (merged) # spent 119µs executing statements in string eval # spent 116µs executing statements in string eval # spent 116µs executing statements in string eval # spent 112µs executing statements in string eval # spent 110µs executing statements in 4 string evals (merged) # spent 109µs executing statements in string eval # spent 101µs executing statements in string eval # spent 101µs executing statements in 2 string evals (merged) # spent 100µs executing statements in 3 string evals (merged) # spent 98µs executing statements in 3 string evals (merged) # spent 98µs executing statements in string eval # spent 92µs executing statements in string eval # spent 8µs executing statements in 2 string evals (merged) # spent 7µs executing statements in 2 string evals (merged) # spent 7µs executing statements in 3 string evals (merged) # spent 6µs executing statements in 2 string evals (merged) # spent 5µs executing statements in 2 string evals (merged) # spent 4µs executing statements in string eval # spent 4µs executing statements in string eval # spent 4µs executing statements in string eval # spent 3µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval
82 # Only ignore "Can't locate" errors from our eval require.
83 # Other fatal errors (syntax etc) must be reported.
848814µs die if $@ && $@ !~ /^Can't locate .*? at \(eval /;
8588206µs unless (%{"$base\::"}) {
86 require Carp;
87 local $" = " ";
88 Carp::croak(<<ERROR);
89Base class package "$base" is empty.
90 (Perhaps you need to 'use' the module which defines that package first,
91 or make that module available in \@INC (\@INC contains: @INC).
92ERROR
93 }
9488223µs $sigdie = $SIG{__DIE__} || undef;
95 }
96 # Make sure a global $SIG{__DIE__} makes it out of the localization.
978826µs $SIG{__DIE__} = $sigdie if defined $sigdie;
98 }
998881µs push @bases, $base;
100
10188334µs176549µs if ( has_fields($base) || has_attr($base) ) {
# spent 315µs making 88 calls to base::has_fields, avg 4µs/call # spent 234µs making 88 calls to base::has_attr, avg 3µs/call
102 # No multiple fields inheritance *suck*
103 if ($fields_base) {
104 require Carp;
105 Carp::croak("Can't multiply inherit fields");
106 } else {
107 $fields_base = $base;
108 }
109 }
110 }
111 # Save this until the end so it's all or nothing if the above loop croaks.
11261692µs push @{"$inheritor\::ISA"}, @bases;
113
11461328µs if( defined $fields_base ) {
115 inherit_fields($inheritor, $fields_base);
116 }
117}
118
119
120sub inherit_fields {
121 my($derived, $base) = @_;
122
123 return SUCCESS unless $base;
124
125 my $battr = get_attr($base);
126 my $dattr = get_attr($derived);
127 my $dfields = get_fields($derived);
128 my $bfields = get_fields($base);
129
130 $dattr->[0] = @$battr;
131
132 if( keys %$dfields ) {
133 warn <<"END";
134$derived is inheriting from $base but already has its own fields!
135This will cause problems. Be sure you use base BEFORE declaring fields.
136END
137
138 }
139
140 # Iterate through the base's fields adding all the non-private
141 # ones to the derived class. Hang on to the original attribute
142 # (Public, Private, etc...) and add Inherited.
143 # This is all too complicated to do efficiently with add_fields().
144 while (my($k,$v) = each %$bfields) {
145 my $fno;
146 if ($fno = $dfields->{$k} and $fno != $v) {
147 require Carp;
148 Carp::croak ("Inherited fields can't override existing fields");
149 }
150
151 if( $battr->[$v] & PRIVATE ) {
152 $dattr->[$v] = PRIVATE | INHERITED;
153 }
154 else {
155 $dattr->[$v] = INHERITED | $battr->[$v];
156 $dfields->{$k} = $v;
157 }
158 }
159
160 foreach my $idx (1..$#{$battr}) {
161 next if defined $dattr->[$idx];
162 $dattr->[$idx] = $battr->[$idx] & INHERITED;
163 }
164}
165
166
167111µs1;
168
169__END__