Profile of Class/Factory/Util.pm

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

Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Class/Factory/Util.pm
Statements | Executed 43 statements in 550µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
7 | 1 | 1 | 56µs | 122µs | Class::Factory::Util::::_scandirClass::Factory::Util::_scandir
1 | 1 | 1 | 52µs | 184µs | Class::Factory::Util::::_subclassesClass::Factory::Util::_subclasses
7 | 1 | 1 | 20µs | 20µs | Class::Factory::Util::::CORE:ftdirClass::Factory::Util::CORE:ftdir (opcode)
1 | 1 | 1 | 17µs | 17µs | Class::Factory::Util::::CORE:readdirClass::Factory::Util::CORE:readdir (opcode)
1 | 1 | 1 | 16µs | 19µs | Class::Factory::Util::::BEGIN@3Class::Factory::Util::BEGIN@3
5 | 1 | 1 | 15µs | 15µs | Class::Factory::Util::::CORE:ftfileClass::Factory::Util::CORE:ftfile (opcode)
1 | 1 | 1 | 12µs | 12µs | Class::Factory::Util::::CORE:open_dirClass::Factory::Util::CORE:open_dir (opcode)
1 | 1 | 1 | 8µs | 8µs | Class::Factory::Util::::importClass::Factory::Util::import
1 | 1 | 1 | 7µs | 33µs | Class::Factory::Util::::BEGIN@6Class::Factory::Util::BEGIN@6
1 | 1 | 1 | 7µs | 19µs | Class::Factory::Util::::BEGIN@17Class::Factory::Util::BEGIN@17
1 | 1 | 1 | 6µs | 31µs | Class::Factory::Util::::BEGIN@4Class::Factory::Util::BEGIN@4
1 | 1 | 1 | 6µs | 6µs | Class::Factory::Util::::CORE:substClass::Factory::Util::CORE:subst (opcode)
1 | 1 | 1 | 4µs | 4µs | Class::Factory::Util::::CORE:sortClass::Factory::Util::CORE:sort (opcode)
1 | 1 | 1 | 2µs | 2µs | Class::Factory::Util::::CORE:closedirClass::Factory::Util::CORE:closedir (opcode)
0 | 0 | 0 | 0s | 0s | Class::Factory::Util::::subclassesClass::Factory::Util::subclasses

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Class::Factory::Util;
2 |  |  |  |  |
3 | 3 | 23µs | 2 | 23µs | # spent 19µs (16+4) within Class::Factory::Util::BEGIN@3 which was called: # once (16µs+4µs) by DateTime::Format::Builder::Parser::BEGIN@626 at line 3 use strict; # spent 19µs making 1 call to Class::Factory::Util::BEGIN@3 # spent 4µs making 1 call to strict::import
4 | 3 | 20µs | 2 | 56µs | # spent 31µs (6+25) within Class::Factory::Util::BEGIN@4 which was called: # once (6µs+25µs) by DateTime::Format::Builder::Parser::BEGIN@626 at line 4 use vars qw($VERSION); # spent 31µs making 1 call to Class::Factory::Util::BEGIN@4 # spent 25µs making 1 call to vars::import
5 |  |  |  |  |
6 | 3 | 34µs | 2 | 59µs | # spent 33µs (7+26) within Class::Factory::Util::BEGIN@6 which was called: # once (7µs+26µs) by DateTime::Format::Builder::Parser::BEGIN@626 at line 6 use Carp qw(confess); # spent 33µs making 1 call to Class::Factory::Util::BEGIN@6 # spent 26µs making 1 call to Exporter::import
7 |  |  |  |  |
8 | 1 | 600ns |  |  | $VERSION = '1.7';
9 |  |  |  |  |
10 | 1 | 3µs |  |  | 1;
11 |  |  |  |  |
12 |  |  |  |  | sub import
13 |  |  |  |  | # spent 8µs within Class::Factory::Util::import which was called: # once (8µs+0s) by DateTime::Format::Builder::Parser::BEGIN@626 at line 626 of DateTime/Format/Builder/Parser.pm {
14 | 3 | 10µs |  |  | my $caller = caller(0);
15 |  |  |  |  |
16 |  |  |  |  | {
17 | 3 | 273µs | 2 | 31µs | # spent 19µs (7+12) within Class::Factory::Util::BEGIN@17 which was called: # once (7µs+12µs) by DateTime::Format::Builder::Parser::BEGIN@626 at line 17 no strict 'refs'; # spent 19µs making 1 call to Class::Factory::Util::BEGIN@17 # spent 12µs making 1 call to strict::unimport
18 |  |  |  |  | *{"${caller}::subclasses"} = \&_subclasses;
19 |  |  |  |  | }
20 |  |  |  |  | }
21 |  |  |  |  |
22 |  |  |  |  | # deprecated
23 |  |  |  |  | sub subclasses { _subclasses(@_) }
24 |  |  |  |  |
25 |  |  |  |  | sub _subclasses
26 |  |  |  |  | # spent 184µs (52+132) within Class::Factory::Util::_subclasses which was called: # once (52µs+132µs) by DateTime::Format::SQLite::BEGIN@16 at line 628 of DateTime/Format/Builder/Parser.pm {
27 | 8 | 56µs |  |  | my $base = shift;
28 |  |  |  |  |
29 |  |  | 1 | 6µs | $base =~ s,::,/,g; # spent 6µs making 1 call to Class::Factory::Util::CORE:subst
30 |  |  |  |  |
31 |  |  |  |  | my %dirs = map { $_ => 1 } @INC;
32 |  |  |  |  |
33 |  |  |  |  | my $dir = substr( $INC{"$base.pm"}, 0, (length $INC{"$base.pm"}) - 3 );
34 |  |  |  |  |
35 |  |  |  |  | $dirs{$dir} = 1;
36 |  |  |  |  |
37 |  |  | 7 | 122µs | my @packages = map { _scandir( "$_/$base" ) } keys %dirs; # spent 122µs making 7 calls to Class::Factory::Util::_scandir, avg 17µs/call
38 |  |  |  |  |
39 |  |  |  |  | # Make list of unique elements
40 |  |  |  |  | my %packages = map { $_ => 1 } @packages;
41 |  |  |  |  |
42 |  |  | 1 | 4µs | return sort keys %packages; # spent 4µs making 1 call to Class::Factory::Util::CORE:sort
43 |  |  |  |  | }
44 |  |  |  |  |
45 |  |  |  |  | sub _scandir
46 |  |  |  |  | # spent 122µs (56+66) within Class::Factory::Util::_scandir which was called 7 times, avg 17µs/call: # 7 times (56µs+66µs) by Class::Factory::Util::_subclasses at line 37, avg 17µs/call {
47 | 18 | 129µs |  |  | my $dir = shift;
48 |  |  |  |  |
49 |  |  | 7 | 20µs | return unless -d $dir; # spent 20µs making 7 calls to Class::Factory::Util::CORE:ftdir, avg 3µs/call
50 |  |  |  |  |
51 |  |  | 1 | 12µs | opendir DIR, $dir # spent 12µs making 1 call to Class::Factory::Util::CORE:open_dir
52 |  |  |  |  | or confess ("Cannot open directory $dir: $!");
53 |  |  |  |  |
54 |  |  |  |  | my @packages =
55 |  |  |  |  | ( map { substr($_, 0, length($_) - 3) }
56 |  |  | 6 | 32µs | grep { substr($_, -3) eq '.pm' && -f "$dir/$_" } # spent 17µs making 1 call to Class::Factory::Util::CORE:readdir # spent 15µs making 5 calls to Class::Factory::Util::CORE:ftfile, avg 3µs/call
57 |  |  |  |  | readdir DIR
58 |  |  |  |  | );
59 |  |  |  |  |
60 |  |  | 1 | 2µs | closedir DIR # spent 2µs making 1 call to Class::Factory::Util::CORE:closedir
61 |  |  |  |  | or confess("Cannot close directory $dir: $!" );
62 |  |  |  |  |
63 |  |  |  |  | return @packages;
64 |  |  |  |  | }
65 |  |  |  |  |
66 |  |  |  |  | __END__
|  |  |  |  | # spent 2µs within Class::Factory::Util::CORE:closedir which was called: # once (2µs+0s) by Class::Factory::Util::_scandir at line 60 sub Class::Factory::Util::CORE:closedir; # opcode
|  |  |  |  | # spent 20µs within Class::Factory::Util::CORE:ftdir which was called 7 times, avg 3µs/call: # 7 times (20µs+0s) by Class::Factory::Util::_scandir at line 49, avg 3µs/call sub Class::Factory::Util::CORE:ftdir; # opcode
|  |  |  |  | # spent 15µs within Class::Factory::Util::CORE:ftfile which was called 5 times, avg 3µs/call: # 5 times (15µs+0s) by Class::Factory::Util::_scandir at line 56, avg 3µs/call sub Class::Factory::Util::CORE:ftfile; # opcode
|  |  |  |  | # spent 12µs within Class::Factory::Util::CORE:open_dir which was called: # once (12µs+0s) by Class::Factory::Util::_scandir at line 51 sub Class::Factory::Util::CORE:open_dir; # opcode
|  |  |  |  | # spent 17µs within Class::Factory::Util::CORE:readdir which was called: # once (17µs+0s) by Class::Factory::Util::_scandir at line 56 sub Class::Factory::Util::CORE:readdir; # opcode
|  |  |  |  | # spent 4µs within Class::Factory::Util::CORE:sort which was called: # once (4µs+0s) by Class::Factory::Util::_subclasses at line 42 sub Class::Factory::Util::CORE:sort; # opcode
|  |  |  |  | # spent 6µs within Class::Factory::Util::CORE:subst which was called: # once (6µs+0s) by Class::Factory::Util::_subclasses at line 29 sub Class::Factory::Util::CORE:subst; # opcode