Profile of YAML/Mo.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:36 2012

Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/YAML/Mo.pm
Statements | Executed 87 statements in 1.20ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
16 | 6 | 2 | 220µs | 338µs | YAML::Mo::::__ANON__[:5]YAML::Mo::__ANON__[:5]
1 | 1 | 1 | 14µs | 32µs | YAML::Mo::::BEGIN@5YAML::Mo::BEGIN@5
1 | 1 | 1 | 11µs | 24µs | YAML::Mo::::BEGIN@5.11YAML::Mo::BEGIN@5.11
1 | 1 | 1 | 10µs | 14µs | YAML::Mo::::BEGIN@5.10YAML::Mo::BEGIN@5.10
1 | 1 | 1 | 7µs | 21µs | YAML::Mo::::BEGIN@11YAML::Mo::BEGIN@11
4 | 1 | 1 | 5µs | 5µs | YAML::Mo::::CORE:sortYAML::Mo::CORE:sort (opcode)
3 | 1 | 1 | 3µs | 3µs | YAML::Mo::::CORE:matchYAML::Mo::CORE:match (opcode)
0 | 0 | 0 | 0s | 0s | YAML::Mo::::__ANON__[:17]YAML::Mo::__ANON__[:17]
0 | 0 | 0 | 0s | 0s | YAML::Mo::::__ANON__[:25]YAML::Mo::__ANON__[:25]
0 | 0 | 0 | 0s | 0s | YAML::Mo::::__ANON__[:51]YAML::Mo::__ANON__[:51]
0 | 0 | 0 | 0s | 0s | YAML::Mo::::__ANON__[:56]YAML::Mo::__ANON__[:56]
0 | 0 | 0 | 0s | 0s | YAML::Mo::::__ANON__[:65]YAML::Mo::__ANON__[:65]
0 | 0 | 0 | 0s | 0s | YAML::Mo::::__ANON__[:78]YAML::Mo::__ANON__[:78]

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

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 | 1 | 500ns |  |  | package YAML::Mo; $VERSION = '0.81';
2 |  |  |  |  | # use Mo qw[builder default import];
3 |  |  |  |  | # The following line of code was produced from the previous line by
4 |  |  |  |  | # Mo::Inline version 0.31
5 | 74 | 777µs | 25 | 341µs | # spent 14µs (10+4) within YAML::Mo::BEGIN@5.10 which was called: # once (10µs+4µs) by YAML::BEGIN@3 at line 5 # spent 338µs (220+118) within YAML::Mo::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/YAML/Mo.pm:5] which was called 16 times, avg 21µs/call: # 11 times (138µs+82µs) by YAML::BEGIN@3 or YAML::Mo::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/YAML/Mo.pm:5] at line 5, avg 20µs/call # once (23µs+13µs) by Tapper::MCP::Net::BEGIN@16 at line 18 of YAML.pm # once (19µs+7µs) by Tapper::MCP::Net::BEGIN@16 at line 19 of YAML.pm # once (14µs+7µs) by Tapper::MCP::Net::BEGIN@16 at line 21 of YAML.pm # once (12µs+6µs) by Tapper::MCP::Net::BEGIN@16 at line 20 of YAML.pm # once (14µs+3µs) by YAML::BEGIN@3 at line 3 of YAML.pm # spent 24µs (11+13) within YAML::Mo::BEGIN@5.11 which was called: # once (11µs+13µs) by YAML::BEGIN@3 at line 5 # spent 32µs (14+18) within YAML::Mo::BEGIN@5 which was called: # once (14µs+18µs) by YAML::BEGIN@3 at line 5 no warnings;my$M=__PACKAGE__.'::';*{$M.Object::new}=sub{bless{@_[1..$#_]},$_[0]};*{$M.import}=sub{import warnings;$^H|=1538;my($P,%e,%o)=caller.'::';shift;eval"no Mo::$_",&{$M.$_.::e}($P,\%e,\%o,\@_)for@_;return if$e{M};%e=(extends,sub{eval"no $_[0]()";@{$P.ISA}=$_[0]},has,sub{my$n=shift;my$m=sub{$#_?$_[0]{$n}=$_[1]:$_[0]{$n}};$m=$o{$_}->($m,$n,@_)for sort keys%o;*{$P.$n}=$m},%e,);*{$P.$_}=$e{$_}for keys%e;@{$P.ISA}=$M.Object};*{$M.'builder::e'}=sub{my($P,$e,$o)=@_;$o->{builder}=sub{my($m,$n,%a)=@_;my$b=$a{builder}or return$m;sub{$#_?$m->(@_):!exists$_[0]{$n}?$_[0]{$n}=$_[0]->$b:$m->(@_)}}};*{$M.'default::e'}=sub{my($P,$e,$o)=@_;$o->{default}=sub{my($m,$n,%a)=@_;$a{default}or return$m;sub{$#_?$m->(@_):!exists$_[0]{$n}?$_[0]{$n}=$a{default}->(@_):$m->(@_)}}};my$i=\&import;*{$M.import}=sub{(@_==2 and not $_[1])?pop@_:@_==1?push@_,grep!/import/,@f:();goto&$i};@f=qw[builder default import];use strict;use warnings; # spent 220µs making 11 calls to YAML::Mo::__ANON__[YAML/Mo.pm:5], avg 20µs/call # spent 32µs making 1 call to YAML::Mo::BEGIN@5 # spent 24µs making 1 call to YAML::Mo::BEGIN@5.11 # spent 20µs making 2 calls to warnings::import, avg 10µs/call # spent 18µs making 1 call to warnings::unimport # spent 14µs making 1 call to YAML::Mo::BEGIN@5.10 # spent 5µs making 4 calls to YAML::Mo::CORE:sort, avg 1µs/call # spent 4µs making 1 call to strict::import # spent 3µs making 3 calls to YAML::Mo::CORE:match, avg 1µs/call # spent 44µs executing statements in string eval # includes 37µs spent executing 1 call to 1 sub defined therein. # spent 34µs executing statements in string eval # includes 27µs spent executing 1 call to 1 sub defined therein.
6 |  |  |  |  |
7 | 1 | 300ns |  |  | our $DumperModule = 'Data::Dumper';
8 |  |  |  |  |
9 | 1 | 400ns |  |  | my ($_new_error, $_info, $_scalar_info);
10 |  |  |  |  |
11 | 3 | 395µs | 2 | 34µs | # spent 21µs (7+13) within YAML::Mo::BEGIN@11 which was called: # once (7µs+13µs) by YAML::BEGIN@3 at line 11 no strict 'refs'; # spent 21µs making 1 call to YAML::Mo::BEGIN@11 # spent 14µs making 1 call to strict::unimport
12 |  |  |  |  | *{$M.'Object::die'} = sub {
13 |  |  |  |  | my $self = shift;
14 |  |  |  |  | my $error = $self->$_new_error(@_);
15 |  |  |  |  | $error->type('Error');
16 |  |  |  |  | Carp::croak($error->format_message);
17 | 1 | 3µs |  |  | };
18 |  |  |  |  |
19 |  |  |  |  | *{$M.'Object::warn'} = sub {
20 |  |  |  |  | my $self = shift;
21 |  |  |  |  | return unless $^W;
22 |  |  |  |  | my $error = $self->$_new_error(@_);
23 |  |  |  |  | $error->type('Warning');
24 |  |  |  |  | Carp::cluck($error->format_message);
25 | 1 | 3µs |  |  | };
26 |  |  |  |  |
27 |  |  |  |  | # This code needs to be refactored to be simpler and more precise, and no,
28 |  |  |  |  | # Scalar::Util doesn't DWIM.
29 |  |  |  |  | #
30 |  |  |  |  | # Can't handle:
31 |  |  |  |  | # * blessed regexp
32 |  |  |  |  | *{$M.'Object::node_info'} = sub {
33 |  |  |  |  | my $self = shift;
34 |  |  |  |  | my $stringify = $_[1] || 0;
35 |  |  |  |  | my ($class, $type, $id) =
36 |  |  |  |  | ref($_[0])
37 |  |  |  |  | ? $stringify
38 |  |  |  |  | ? &$_info("$_[0]")
39 |  |  |  |  | : do {
40 |  |  |  |  | require overload;
41 |  |  |  |  | my @info = &$_info(overload::StrVal($_[0]));
42 |  |  |  |  | if (ref($_[0]) eq 'Regexp') {
43 |  |  |  |  | @info[0, 1] = (undef, 'REGEXP');
44 |  |  |  |  | }
45 |  |  |  |  | @info;
46 |  |  |  |  | }
47 |  |  |  |  | : &$_scalar_info($_[0]);
48 |  |  |  |  | ($class, $type, $id) = &$_scalar_info("$_[0]")
49 |  |  |  |  | unless $id;
50 |  |  |  |  | return wantarray ? ($class, $type, $id) : $id;
51 | 1 | 4µs |  |  | };
52 |  |  |  |  |
53 |  |  |  |  | #-------------------------------------------------------------------------------
54 |  |  |  |  | $_info = sub {
55 |  |  |  |  | return (($_[0]) =~ qr{^(?:(.*)\=)?([^=]*)\(([^\(]*)\)$}o);
56 | 1 | 1µs |  |  | };
57 |  |  |  |  |
58 |  |  |  |  | $_scalar_info = sub {
59 |  |  |  |  | my $id = 'undef';
60 |  |  |  |  | if (defined $_[0]) {
61 |  |  |  |  | \$_[0] =~ /\((\w+)\)$/o or CORE::die();
62 |  |  |  |  | $id = "$1-S";
63 |  |  |  |  | }
64 |  |  |  |  | return (undef, undef, $id);
65 | 1 | 1µs |  |  | };
66 |  |  |  |  |
67 |  |  |  |  | $_new_error = sub {
68 |  |  |  |  | require Carp;
69 |  |  |  |  | my $self = shift;
70 |  |  |  |  | require YAML::Error;
71 |  |  |  |  |
72 |  |  |  |  | my $code = shift || 'unknown error';
73 |  |  |  |  | my $error = YAML::Error->new(code => $code);
74 |  |  |  |  | $error->line($self->line) if $self->can('line');
75 |  |  |  |  | $error->document($self->document) if $self->can('document');
76 |  |  |  |  | $error->arguments([@_]);
77 |  |  |  |  | return $error;
78 | 1 | 4µs |  |  | };
79 |  |  |  |  |
80 | 1 | 10µs |  |  | 1;
|  |  |  |  | # spent 3µs within YAML::Mo::CORE:match which was called 3 times, avg 1µs/call: # 3 times (3µs+0s) by YAML::Mo::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/YAML/Mo.pm:5] at line 5, avg 1µs/call sub YAML::Mo::CORE:match; # opcode
|  |  |  |  | # spent 5µs within YAML::Mo::CORE:sort which was called 4 times, avg 1µs/call: # 4 times (5µs+0s) by YAML::Mo::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/YAML/Mo.pm:5] at line 5, avg 1µs/call sub YAML::Mo::CORE:sort; # opcode