Profile of attributes.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For t/app_dpath.t
Run on Tue Jun 5 15:25:28 2012
Reported on Tue Jun 5 15:26:04 2012

Filename | /home/ss5/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/x86_64-linux-thread-multi/attributes.pm
Statements | Executed 23 statements in 3.64ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 87µs | 146µs | attributes::::importattributes::import
1 | 1 | 1 | 82µs | 210µs | attributes::::BEGIN@9attributes::BEGIN@9
2 | 2 | 1 | 32µs | 32µs | attributes::::CORE:qrattributes::CORE:qr (opcode)
1 | 1 | 1 | 28µs | 31µs | attributes::::_modify_attrs_and_deprecateattributes::_modify_attrs_and_deprecate
1 | 1 | 1 | 8µs | 8µs | attributes::::reftypeattributes::reftype (xsub)
1 | 1 | 1 | 3µs | 3µs | attributes::::_modify_attrsattributes::_modify_attrs (xsub)
0 | 0 | 0 | 0s | 0s | attributes::::carpattributes::carp
0 | 0 | 0 | 0s | 0s | attributes::::croakattributes::croak
0 | 0 | 0 | 0s | 0s | attributes::::getattributes::get
0 | 0 | 0 | 0s | 0s | attributes::::require_versionattributes::require_version

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

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package attributes;
2 |  |  |  |  |
3 | 1 | 2µs |  |  | our $VERSION = 0.14;
4 |  |  |  |  |
5 | 1 | 7µs |  |  | @EXPORT_OK = qw(get reftype);
6 | 1 | 1µs |  |  | @EXPORT = ();
7 | 1 | 10µs |  |  | %EXPORT_TAGS = (ALL => [@EXPORT, @EXPORT_OK]);
8 |  |  |  |  |
9 | 2 | 2.58ms | 2 | 338µs | # spent 210µs (82+128) within attributes::BEGIN@9 which was called: # once (82µs+128µs) by DynaLoader::BEGIN@95 at line 9 use strict; # spent 210µs making 1 call to attributes::BEGIN@9 # spent 128µs making 1 call to strict::import
10 |  |  |  |  |
11 |  |  |  |  | sub croak {
12 |  |  |  |  | require Carp;
13 |  |  |  |  | goto &Carp::croak;
14 |  |  |  |  | }
15 |  |  |  |  |
16 |  |  |  |  | sub carp {
17 |  |  |  |  | require Carp;
18 |  |  |  |  | goto &Carp::carp;
19 |  |  |  |  | }
20 |  |  |  |  |
21 | 1 | 1µs |  |  | my %deprecated;
22 | 1 | 57µs | 1 | 27µs | $deprecated{CODE} = qr/\A-?(locked)\z/; # spent 27µs making 1 call to attributes::CORE:qr
23 | 1 | 17µs | 1 | 5µs | $deprecated{ARRAY} = $deprecated{HASH} = $deprecated{SCALAR} # spent 5µs making 1 call to attributes::CORE:qr
24 |  |  |  |  | = qr/\A-?(unique)\z/;
25 |  |  |  |  |
26 |  |  |  |  | # spent 31µs (28+3) within attributes::_modify_attrs_and_deprecate which was called: # once (28µs+3µs) by attributes::import at line 72 sub _modify_attrs_and_deprecate {
27 | 2 | 36µs |  |  | my $svtype = shift;
28 |  |  |  |  | # Now that we've removed handling of locked from the XS code, we need to
29 |  |  |  |  | # remove it here, else it ends up in @badattrs. (If we do the deprecation in
30 |  |  |  |  | # XS, we can't control the warning based on *our* caller's lexical settings,
31 |  |  |  |  | # and the warned line is in this package)
32 |  |  |  |  | grep {
33 |  |  | 1 | 3µs | $deprecated{$svtype} && /$deprecated{$svtype}/ ? do { # spent 3µs making 1 call to attributes::_modify_attrs
34 |  |  |  |  | require warnings;
35 |  |  |  |  | warnings::warnif('deprecated', "Attribute \"$1\" is deprecated");
36 |  |  |  |  | 0;
37 |  |  |  |  | } : 1
38 |  |  |  |  | } _modify_attrs(@_);
39 |  |  |  |  | }
40 |  |  |  |  |
41 |  |  |  |  | # spent 146µs (87+59) within attributes::import which was called: # once (87µs+59µs) by DynaLoader::BEGIN@95 at line 95 of XSLoader.pm sub import {
42 | 8 | 105µs |  |  | @_ > 2 && ref $_[2] or do {
43 |  |  |  |  | require Exporter;
44 |  |  |  |  | goto &Exporter::import;
45 |  |  |  |  | };
46 |  |  |  |  | my (undef,$home_stash,$svref,@attrs) = @_;
47 |  |  |  |  |
48 |  |  | 1 | 8µs | my $svtype = uc reftype($svref); # spent 8µs making 1 call to attributes::reftype
49 |  |  |  |  | my $pkgmeth;
50 |  |  | 1 | 20µs | $pkgmeth = UNIVERSAL::can($home_stash, "MODIFY_${svtype}_ATTRIBUTES") # spent 20µs making 1 call to UNIVERSAL::can
51 |  |  |  |  | if defined $home_stash && $home_stash ne '';
52 |  |  |  |  | my @badattrs;
53 | 1 | 9µs |  |  | if ($pkgmeth) {
54 |  |  |  |  | my @pkgattrs = _modify_attrs_and_deprecate($svtype, $svref, @attrs);
55 |  |  |  |  | @badattrs = $pkgmeth->($home_stash, $svref, @pkgattrs);
56 |  |  |  |  | if (!@badattrs && @pkgattrs) {
57 |  |  |  |  | require warnings;
58 |  |  |  |  | return unless warnings::enabled('reserved');
59 |  |  |  |  | @pkgattrs = grep { m/\A[[:lower:]]+(?:\z|\()/ } @pkgattrs;
60 |  |  |  |  | if (@pkgattrs) {
61 |  |  |  |  | for my $attr (@pkgattrs) {
62 |  |  |  |  | $attr =~ s/\(.+\z//s;
63 |  |  |  |  | }
64 |  |  |  |  | my $s = ((@pkgattrs == 1) ? '' : 's');
65 |  |  |  |  | carp "$svtype package attribute$s " .
66 |  |  |  |  | "may clash with future reserved word$s: " .
67 |  |  |  |  | join(' : ' , @pkgattrs);
68 |  |  |  |  | }
69 |  |  |  |  | }
70 |  |  |  |  | }
71 |  |  |  |  | else {
72 |  |  | 1 | 31µs | @badattrs = _modify_attrs_and_deprecate($svtype, $svref, @attrs); # spent 31µs making 1 call to attributes::_modify_attrs_and_deprecate
73 |  |  |  |  | }
74 |  |  |  |  | if (@badattrs) {
75 |  |  |  |  | croak "Invalid $svtype attribute" .
76 |  |  |  |  | (( @badattrs == 1 ) ? '' : 's') .
77 |  |  |  |  | ": " .
78 |  |  |  |  | join(' : ', @badattrs);
79 |  |  |  |  | }
80 |  |  |  |  | }
81 |  |  |  |  |
82 |  |  |  |  | sub get ($) {
83 |  |  |  |  | @_ == 1 && ref $_[0] or
84 |  |  |  |  | croak 'Usage: '.__PACKAGE__.'::get $ref';
85 |  |  |  |  | my $svref = shift;
86 |  |  |  |  | my $svtype = uc reftype($svref);
87 |  |  |  |  | my $stash = _guess_stash($svref);
88 |  |  |  |  | $stash = caller unless defined $stash;
89 |  |  |  |  | my $pkgmeth;
90 |  |  |  |  | $pkgmeth = UNIVERSAL::can($stash, "FETCH_${svtype}_ATTRIBUTES")
91 |  |  |  |  | if defined $stash && $stash ne '';
92 |  |  |  |  | return $pkgmeth ?
93 |  |  |  |  | (_fetch_attrs($svref), $pkgmeth->($stash, $svref)) :
94 |  |  |  |  | (_fetch_attrs($svref))
95 |  |  |  |  | ;
96 |  |  |  |  | }
97 |  |  |  |  |
98 |  |  |  |  | sub require_version { goto &UNIVERSAL::VERSION }
99 |  |  |  |  |
100 | 1 | 2µs |  |  | require XSLoader;
101 | 1 | 774µs | 1 | 0s | XSLoader::load(); # spent 746µs making 1 call to XSLoader::load, recursion: max depth 1, sum of overlapping time 746µs
102 |  |  |  |  |
103 | 1 | 39µs |  |  | 1;
104 |  |  |  |  | __END__
|  |  |  |  | # spent 32µs within attributes::CORE:qr which was called 2 times, avg 16µs/call: # once (27µs+0s) by DynaLoader::BEGIN@95 at line 22 # once (5µs+0s) by DynaLoader::BEGIN@95 at line 23 sub attributes::CORE:qr; # opcode
|  |  |  |  | # spent 3µs within attributes::_modify_attrs which was called: # once (3µs+0s) by attributes::_modify_attrs_and_deprecate at line 33 sub attributes::_modify_attrs; # xsub
|  |  |  |  | # spent 8µs within attributes::reftype which was called: # once (8µs+0s) by attributes::import at line 48 sub attributes::reftype; # xsub