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

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/MooseX/Traits.pm
StatementsExecuted 34 statements in 1.43ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111606µs43.2msMooseX::Traits::::BEGIN@9MooseX::Traits::BEGIN@9
111479µs971µsMooseX::Traits::::BEGIN@4MooseX::Traits::BEGIN@4
11164µs14.3msMooseX::Traits::::new_with_traitsMooseX::Traits::new_with_traits
11127µs344µsMooseX::Traits::::BEGIN@86MooseX::Traits::BEGIN@86
11119µs3.05msMooseX::Traits::::BEGIN@2MooseX::Traits::BEGIN@2
11117µs11.0msMooseX::Traits::::with_traitsMooseX::Traits::with_traits
1119µs74µsMooseX::Traits::::BEGIN@7MooseX::Traits::BEGIN@7
1116µs19µsMooseX::Traits::::BEGIN@6MooseX::Traits::BEGIN@6
0000s0sMooseX::Traits::::apply_traitsMooseX::Traits::apply_traits
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package MooseX::Traits;
2361µs26.09ms
# spent 3.05ms (19µs+3.03) within MooseX::Traits::BEGIN@2 which was called: # once (19µs+3.03ms) by Module::Runtime::require_module at line 2
use Moose::Role;
# spent 3.05ms making 1 call to MooseX::Traits::BEGIN@2 # spent 3.03ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:492]
3
43126µs21.10ms
# spent 971µs (479+492) within MooseX::Traits::BEGIN@4 which was called: # once (479µs+492µs) by Module::Runtime::require_module at line 4
use MooseX::Traits::Util qw(new_class_with_traits);
# spent 971µs making 1 call to MooseX::Traits::BEGIN@4 # spent 133µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:756]
5
6318µs231µs
# spent 19µs (6+12) within MooseX::Traits::BEGIN@6 which was called: # once (6µs+12µs) by Module::Runtime::require_module at line 6
use warnings;
# spent 19µs making 1 call to MooseX::Traits::BEGIN@6 # spent 12µs making 1 call to warnings::import
7321µs2140µs
# spent 74µs (9+65) within MooseX::Traits::BEGIN@7 which was called: # once (9µs+65µs) by Module::Runtime::require_module at line 7
use warnings::register;
# spent 74µs making 1 call to MooseX::Traits::BEGIN@7 # spent 66µs making 1 call to warnings::register::import
8
931.01ms243.3ms
# spent 43.2ms (606µs+42.6) within MooseX::Traits::BEGIN@9 which was called: # once (606µs+42.6ms) by Module::Runtime::require_module at line 9
use namespace::autoclean;
# spent 43.2ms making 1 call to MooseX::Traits::BEGIN@9 # spent 107µs making 1 call to namespace::autoclean::import
10
1112µsour $VERSION = '0.11';
121900nsour $AUTHORITY = 'id:JROCKWAY';
13
1415µs1492µshas '_trait_namespace' => (
# spent 492µs making 1 call to Moose::Role::has
15 # no accessors or init_arg
16 init_arg => undef,
17 isa => 'Str',
18 is => 'bare',
19);
20
21
# spent 11.0ms (17µs+10.9) within MooseX::Traits::with_traits which was called: # once (17µs+10.9ms) by MooseX::Traits::new_with_traits at line 46
sub with_traits {
22319µs my ($class, @traits) = @_;
23
24110.9ms my $new_class = new_class_with_traits(
# spent 10.9ms making 1 call to MooseX::Traits::Util::new_class_with_traits
25 $class,
26 @traits,
27 );
28
291800ns return $new_class->name;
# spent 800ns making 1 call to Class::MOP::Package::name
30}
31
32# somewhat deprecated, but use if you want to
33
# spent 14.3ms (64µs+14.3) within MooseX::Traits::new_with_traits which was called: # once (64µs+14.3ms) by main::RUNTIME at line 45 of xt/tapper-mcp-scheduler-with-db-longrun.t
sub new_with_traits {
34949µs my $class = shift;
35
36 my ($hashref, %args) = 0;
37 if (ref($_[0]) eq 'HASH') {
38 %args = %{ +shift };
39 $hashref = 1;
40 } else {
41 %args = @_;
42 }
43
44 my $traits = delete $args{traits} || [];
45
46111.0ms my $new_class = $class->with_traits(ref $traits ? @$traits : $traits );
# spent 11.0ms making 1 call to MooseX::Traits::with_traits
47
48218µs my $constructor = $new_class->meta->constructor_name;
# spent 17µs making 1 call to MooseX::Traits::__ANON__::SERIAL::1::meta # spent 1µs making 1 call to Class::MOP::Class::constructor_name
49 confess "$class ($new_class) does not have a constructor defined via the MOP?"
50 if !$constructor;
51
5213.29ms return $new_class->$constructor($hashref ? \%args : %args);
# spent 3.29ms making 1 call to Moose::Object::new
53
54}
55
56# this code is broken and should never have been added. i probably
57# won't delete it, but it is definitely not up-to-date with respect to
58# other features, and never will be.
59#
60# runtime role application is fundamentally broken. if you really
61# need it, write it yourself, but consider applying the roles before
62# you create an instance.
63
64sub apply_traits {
65 my ($self, $traits, $rebless_params) = @_;
66
67 # disable this warning with "use MooseX::Traits; no warnings 'MooseX::Traits'"
68 warnings::warnif('apply_traits is deprecated due to being fundamentally broken. '.
69 q{disable this warning with "no warnings 'MooseX::Traits'"});
70
71 # arrayify
72 my @traits = $traits;
73 @traits = @$traits if ref $traits;
74
75 if (@traits) {
76 @traits = MooseX::Traits::Util::resolve_traits(
77 $self, @traits,
78 );
79
80 for my $trait (@traits){
81 $trait->meta->apply($self, rebless_params => $rebless_params || {});
82 }
83 }
84}
85
86358µs2662µs
# spent 344µs (27+318) within MooseX::Traits::BEGIN@86 which was called: # once (27µs+318µs) by Module::Runtime::require_module at line 86
no Moose::Role;
# spent 344µs making 1 call to MooseX::Traits::BEGIN@86 # spent 318µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:678]
87
88124µs1;
89
90136µs12.14ms__END__