← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/dpath
  Run on Tue Jun 5 15:31:33 2012
Reported on Tue Jun 5 15:31:44 2012

Filename/home/ss5/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/x86_64-linux-thread-multi/Opcode.pm
StatementsExecuted 1794 statements in 17.6ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1117.14ms8.80msOpcode::::_init_optagsOpcode::_init_optags
111751µs1.05msOpcode::::BEGIN@29Opcode::BEGIN@29
31621637µs637µsOpcode::::CORE:matchOpcode::CORE:match (opcode)
2132262µs262µsOpcode::::opsetOpcode::opset (xsub)
2831237µs237µsOpcode::::CORE:readlineOpcode::CORE:readline (opcode)
10111220µs220µsOpcode::::CORE:substOpcode::CORE:subst (opcode)
111187µs187µsOpcode::::opset_to_opsOpcode::opset_to_ops (xsub)
111104µs104µsOpcode::::BEGIN@3Opcode::BEGIN@3
191192µs92µsOpcode::::define_optagOpcode::define_optag (xsub)
11146µs46µsOpcode::::BEGIN@15Opcode::BEGIN@15
11132µs229µsOpcode::::BEGIN@11Opcode::BEGIN@11
11131µs46µsOpcode::::BEGIN@5Opcode::BEGIN@5
11130µs30µsOpcode::::CORE:closeOpcode::CORE:close (opcode)
11127µs27µsOpcode::::_safe_pkg_prepOpcode::_safe_pkg_prep (xsub)
11123µs23µsOpcode::::BEGIN@13Opcode::BEGIN@13
11114µs14µsOpcode::::BEGIN@12Opcode::BEGIN@12
11112µs12µsOpcode::::full_opsetOpcode::full_opset (xsub)
22110µs10µsOpcode::::invert_opsetOpcode::invert_opset (xsub)
0000s0sOpcode::::opdumpOpcode::opdump
0000s0sOpcode::::ops_to_opsetOpcode::ops_to_opset
0000s0sOpcode::::opset_to_hexOpcode::opset_to_hex
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Opcode;
2
32206µs1104µs
# spent 104µs within Opcode::BEGIN@3 which was called: # once (104µs+0s) by Safe::BEGIN@46 at line 3
use 5.006_001;
# spent 104µs making 1 call to Opcode::BEGIN@3
4
52197µs261µs
# spent 46µs (31+15) within Opcode::BEGIN@5 which was called: # once (31µs+15µs) by Safe::BEGIN@46 at line 5
use strict;
# spent 46µs making 1 call to Opcode::BEGIN@5 # spent 15µs making 1 call to strict::import
6
712µsour($VERSION, @ISA, @EXPORT_OK);
8
912µs$VERSION = "1.18";
10
11295µs2426µs
# spent 229µs (32+197) within Opcode::BEGIN@11 which was called: # once (32µs+197µs) by Safe::BEGIN@46 at line 11
use Carp;
# spent 229µs making 1 call to Opcode::BEGIN@11 # spent 197µs making 1 call to Exporter::import
12287µs114µs
# spent 14µs within Opcode::BEGIN@12 which was called: # once (14µs+0s) by Safe::BEGIN@46 at line 12
use Exporter ();
# spent 14µs making 1 call to Opcode::BEGIN@12
132315µs123µs
# spent 23µs within Opcode::BEGIN@13 which was called: # once (23µs+0s) by Safe::BEGIN@46 at line 13
use XSLoader;
# spent 23µs making 1 call to Opcode::BEGIN@13
14
15
# spent 46µs within Opcode::BEGIN@15 which was called: # once (46µs+0s) by Safe::BEGIN@46 at line 24
BEGIN {
16275µs @ISA = qw(Exporter);
17 @EXPORT_OK = qw(
18 opset ops_to_opset
19 opset_to_ops opset_to_hex invert_opset
20 empty_opset full_opset
21 opdesc opcodes opmask define_optag
22 opmask_add verify_opset opdump
23 );
241162µs146µs}
# spent 46µs making 1 call to Opcode::BEGIN@15
25
26sub opset (;@);
27sub opset_to_hex ($);
28sub opdump (;$);
2922.43ms21.36ms
# spent 1.05ms (751µs+304µs) within Opcode::BEGIN@29 which was called: # once (751µs+304µs) by Safe::BEGIN@46 at line 29
use subs @EXPORT_OK;
# spent 1.05ms making 1 call to Opcode::BEGIN@29 # spent 304µs making 1 call to subs::import
30
3115.13ms15.07msXSLoader::load();
# spent 5.07ms making 1 call to XSLoader::load
32
33119µs18.80ms_init_optags();
# spent 8.80ms making 1 call to Opcode::_init_optags
34
35sub ops_to_opset { opset @_ } # alias for old name
36
37sub opset_to_hex ($) {
38 return "(invalid opset)" unless verify_opset($_[0]);
39 unpack("h*",$_[0]);
40}
41
42sub opdump (;$) {
43 my $pat = shift;
44 # handy utility: perl -MOpcode=opdump -e 'opdump File'
45 foreach(opset_to_ops(full_opset)) {
46 my $op = sprintf " %12s %s\n", $_, opdesc($_);
47 next if defined $pat and $op !~ m/$pat/i;
48 print $op;
49 }
50}
51
- -
54
# spent 8.80ms (7.14+1.66) within Opcode::_init_optags which was called: # once (7.14ms+1.66ms) by Safe::BEGIN@46 at line 33
sub _init_optags {
559977µs my(%all, %seen);
562199µs @all{opset_to_ops(full_opset)} = (); # keys only
# spent 187µs making 1 call to Opcode::opset_to_ops # spent 12µs making 1 call to Opcode::full_opset
57
58 local($_);
59 local($/) = "\n=cut"; # skip to optags definition section
601122µs <DATA>;
# spent 122µs making 1 call to Opcode::CORE:readline
61 $/ = "\n="; # now read in 'pod section' chunks
62841µs while(<DATA>) {
# spent 41µs making 8 calls to Opcode::CORE:readline, avg 5µs/call
631402.51ms26166µs next unless m/^item\s+(:\w+)/;
# spent 166µs making 26 calls to Opcode::CORE:match, avg 6µs/call
64 my $tag = $1;
65
66 # Split into lines, keep only indented lines
672902.30ms290470µs my @lines = grep { m/^\s/ } split(/\n/);
# spent 470µs making 290 calls to Opcode::CORE:match, avg 2µs/call
68101840µs101220µs foreach (@lines) { s/--.*// } # delete comments
# spent 220µs making 101 calls to Opcode::CORE:subst, avg 2µs/call
69101298µs my @ops = map { split ' ' } @lines; # get op words
70
71 foreach(@ops) {
7211341.87ms warn "$tag - $_ already tagged in $seen{$_}\n" if $seen{$_};
73 $seen{$_} = $tag;
74 delete $all{$_};
75 }
76 # opset will croak on invalid names
7757410µs define_optag($tag, opset(@ops));
# spent 244µs making 19 calls to Opcode::opset, avg 13µs/call # spent 92µs making 19 calls to Opcode::define_optag, avg 5µs/call # spent 74µs making 19 calls to Opcode::CORE:readline, avg 4µs/call
78 }
79130µs close(DATA);
# spent 30µs making 1 call to Opcode::CORE:close
80 warn "Untagged opnames: ".join(' ',keys %all)."\n" if %all;
81}
82
83
84133µs1;
85
86__DATA__
 
# spent 30µs within Opcode::CORE:close which was called: # once (30µs+0s) by Opcode::_init_optags at line 79
sub Opcode::CORE:close; # opcode
# spent 637µs within Opcode::CORE:match which was called 316 times, avg 2µs/call: # 290 times (470µs+0s) by Opcode::_init_optags at line 67, avg 2µs/call # 26 times (166µs+0s) by Opcode::_init_optags at line 63, avg 6µs/call
sub Opcode::CORE:match; # opcode
# spent 237µs within Opcode::CORE:readline which was called 28 times, avg 8µs/call: # 19 times (74µs+0s) by Opcode::_init_optags at line 77, avg 4µs/call # 8 times (41µs+0s) by Opcode::_init_optags at line 62, avg 5µs/call # once (122µs+0s) by Opcode::_init_optags at line 60
sub Opcode::CORE:readline; # opcode
# spent 220µs within Opcode::CORE:subst which was called 101 times, avg 2µs/call: # 101 times (220µs+0s) by Opcode::_init_optags at line 68, avg 2µs/call
sub Opcode::CORE:subst; # opcode
# spent 27µs within Opcode::_safe_pkg_prep which was called: # once (27µs+0s) by Safe::new at line 176 of Safe.pm
sub Opcode::_safe_pkg_prep; # xsub
# spent 92µs within Opcode::define_optag which was called 19 times, avg 5µs/call: # 19 times (92µs+0s) by Opcode::_init_optags at line 77, avg 5µs/call
sub Opcode::define_optag; # xsub
# spent 12µs within Opcode::full_opset which was called: # once (12µs+0s) by Opcode::_init_optags at line 56
sub Opcode::full_opset; # xsub
# spent 10µs within Opcode::invert_opset which was called 2 times, avg 5µs/call: # once (6µs+0s) by Safe::permit_only at line 262 of Safe.pm # once (5µs+0s) by Safe::permit at line 258 of Safe.pm
sub Opcode::invert_opset; # xsub
# spent 262µs within Opcode::opset which was called 21 times, avg 12µs/call: # 19 times (244µs+0s) by Opcode::_init_optags at line 77, avg 13µs/call # once (10µs+0s) by Safe::permit_only at line 262 of Safe.pm # once (8µs+0s) by Safe::permit at line 258 of Safe.pm
sub Opcode::opset; # xsub
# spent 187µs within Opcode::opset_to_ops which was called: # once (187µs+0s) by Opcode::_init_optags at line 56
sub Opcode::opset_to_ops; # xsub