Profile of Opcode.pm

← 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
Statements | Executed 1794 statements in 17.6ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 7.14ms | 8.80ms | Opcode::::_init_optagsOpcode::_init_optags
1 | 1 | 1 | 751µs | 1.05ms | Opcode::::BEGIN@29Opcode::BEGIN@29
316 | 2 | 1 | 637µs | 637µs | Opcode::::CORE:matchOpcode::CORE:match (opcode)
21 | 3 | 2 | 262µs | 262µs | Opcode::::opsetOpcode::opset (xsub)
28 | 3 | 1 | 237µs | 237µs | Opcode::::CORE:readlineOpcode::CORE:readline (opcode)
101 | 1 | 1 | 220µs | 220µs | Opcode::::CORE:substOpcode::CORE:subst (opcode)
1 | 1 | 1 | 187µs | 187µs | Opcode::::opset_to_opsOpcode::opset_to_ops (xsub)
1 | 1 | 1 | 104µs | 104µs | Opcode::::BEGIN@3Opcode::BEGIN@3
19 | 1 | 1 | 92µs | 92µs | Opcode::::define_optagOpcode::define_optag (xsub)
1 | 1 | 1 | 46µs | 46µs | Opcode::::BEGIN@15Opcode::BEGIN@15
1 | 1 | 1 | 32µs | 229µs | Opcode::::BEGIN@11Opcode::BEGIN@11
1 | 1 | 1 | 31µs | 46µs | Opcode::::BEGIN@5Opcode::BEGIN@5
1 | 1 | 1 | 30µs | 30µs | Opcode::::CORE:closeOpcode::CORE:close (opcode)
1 | 1 | 1 | 27µs | 27µs | Opcode::::_safe_pkg_prepOpcode::_safe_pkg_prep (xsub)
1 | 1 | 1 | 23µs | 23µs | Opcode::::BEGIN@13Opcode::BEGIN@13
1 | 1 | 1 | 14µs | 14µs | Opcode::::BEGIN@12Opcode::BEGIN@12
1 | 1 | 1 | 12µs | 12µs | Opcode::::full_opsetOpcode::full_opset (xsub)
2 | 2 | 1 | 10µs | 10µs | Opcode::::invert_opsetOpcode::invert_opset (xsub)
0 | 0 | 0 | 0s | 0s | Opcode::::opdumpOpcode::opdump
0 | 0 | 0 | 0s | 0s | Opcode::::ops_to_opsetOpcode::ops_to_opset
0 | 0 | 0 | 0s | 0s | Opcode::::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
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Opcode;
2 |  |  |  |  |
3 | 2 | 206µs | 1 | 104µ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 |  |  |  |  |
5 | 2 | 197µs | 2 | 61µ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 |  |  |  |  |
7 | 1 | 2µs |  |  | our($VERSION, @ISA, @EXPORT_OK);
8 |  |  |  |  |
9 | 1 | 2µs |  |  | $VERSION = "1.18";
10 |  |  |  |  |
11 | 2 | 95µs | 2 | 426µ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
12 | 2 | 87µs | 1 | 14µ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
13 | 2 | 315µs | 1 | 23µ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 {
16 | 2 | 75µ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 |  |  |  |  | );
24 | 1 | 162µs | 1 | 46µs | } # spent 46µs making 1 call to Opcode::BEGIN@15
25 |  |  |  |  |
26 |  |  |  |  | sub opset (;@);
27 |  |  |  |  | sub opset_to_hex ($);
28 |  |  |  |  | sub opdump (;$);
29 | 2 | 2.43ms | 2 | 1.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 |  |  |  |  |
31 | 1 | 5.13ms | 1 | 5.07ms | XSLoader::load(); # spent 5.07ms making 1 call to XSLoader::load
32 |  |  |  |  |
33 | 1 | 19µs | 1 | 8.80ms | _init_optags(); # spent 8.80ms making 1 call to Opcode::_init_optags
34 |  |  |  |  |
35 |  |  |  |  | sub ops_to_opset { opset @_ } # alias for old name
36 |  |  |  |  |
37 |  |  |  |  | sub opset_to_hex ($) {
38 |  |  |  |  | return "(invalid opset)" unless verify_opset($_[0]);
39 |  |  |  |  | unpack("h*",$_[0]);
40 |  |  |  |  | }
41 |  |  |  |  |
42 |  |  |  |  | sub 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 {
55 | 9 | 977µs |  |  | my(%all, %seen);
56 |  |  | 2 | 199µ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
60 |  |  | 1 | 122µs | <DATA>; # spent 122µs making 1 call to Opcode::CORE:readline
61 |  |  |  |  | $/ = "\n="; # now read in 'pod section' chunks
62 |  |  | 8 | 41µs | while(<DATA>) { # spent 41µs making 8 calls to Opcode::CORE:readline, avg 5µs/call
63 | 140 | 2.51ms | 26 | 166µ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
67 | 290 | 2.30ms | 290 | 470µs | my @lines = grep { m/^\s/ } split(/\n/); # spent 470µs making 290 calls to Opcode::CORE:match, avg 2µs/call
68 | 101 | 840µs | 101 | 220µs | foreach (@lines) { s/--.*// } # delete comments # spent 220µs making 101 calls to Opcode::CORE:subst, avg 2µs/call
69 | 101 | 298µs |  |  | my @ops = map { split ' ' } @lines; # get op words
70 |  |  |  |  |
71 |  |  |  |  | foreach(@ops) {
72 | 1134 | 1.87ms |  |  | warn "$tag - $_ already tagged in $seen{$_}\n" if $seen{$_};
73 |  |  |  |  | $seen{$_} = $tag;
74 |  |  |  |  | delete $all{$_};
75 |  |  |  |  | }
76 |  |  |  |  | # opset will croak on invalid names
77 |  |  | 57 | 410µ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 |  |  |  |  | }
79 |  |  | 1 | 30µ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 |  |  |  |  |
84 | 1 | 33µs |  |  | 1;
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