| Filename | /home/ss5/perl5/perlbrew/perls/tapper-perl/lib/5.16.3/x86_64-linux/Opcode.pm |
| Statements | Executed 1806 statements in 3.88ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 1.84ms | 2.22ms | Opcode::_init_optags |
| 1 | 1 | 1 | 184µs | 261µs | Opcode::BEGIN@29 |
| 316 | 2 | 1 | 128µs | 128µs | Opcode::CORE:match (opcode) |
| 21 | 3 | 2 | 67µs | 67µs | Opcode::opset (xsub) |
| 28 | 3 | 1 | 65µs | 65µs | Opcode::CORE:readline (opcode) |
| 2 | 1 | 1 | 49µs | 173µs | Opcode::_safe_call_sv (xsub) |
| 101 | 1 | 1 | 43µs | 43µs | Opcode::CORE:subst (opcode) |
| 1 | 1 | 1 | 43µs | 43µs | Opcode::opset_to_ops (xsub) |
| 1 | 1 | 1 | 33µs | 33µs | Opcode::BEGIN@3 |
| 19 | 1 | 1 | 22µs | 22µs | Opcode::define_optag (xsub) |
| 1 | 1 | 1 | 16µs | 40µs | Opcode::BEGIN@5 |
| 1 | 1 | 1 | 13µs | 66µs | Opcode::BEGIN@11 |
| 1 | 1 | 1 | 13µs | 13µs | Opcode::BEGIN@15 |
| 1 | 1 | 1 | 8µs | 8µs | Opcode::CORE:close (opcode) |
| 1 | 1 | 1 | 7µs | 7µs | Opcode::BEGIN@13 |
| 1 | 1 | 1 | 6µs | 6µs | Opcode::_safe_pkg_prep (xsub) |
| 1 | 1 | 1 | 5µs | 5µs | Opcode::BEGIN@12 |
| 2 | 2 | 1 | 2µs | 2µs | Opcode::invert_opset (xsub) |
| 1 | 1 | 1 | 2µs | 2µs | Opcode::full_opset (xsub) |
| 0 | 0 | 0 | 0s | 0s | Opcode::opdump |
| 0 | 0 | 0 | 0s | 0s | Opcode::ops_to_opset |
| 0 | 0 | 0 | 0s | 0s | Opcode::opset_to_hex |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Opcode; | ||||
| 2 | |||||
| 3 | 2 | 99µs | 1 | 33µs | # spent 33µs within Opcode::BEGIN@3 which was called:
# once (33µs+0s) by Safe::BEGIN@46 at line 3 # spent 33µs making 1 call to Opcode::BEGIN@3 |
| 4 | |||||
| 5 | 2 | 72µs | 2 | 64µs | # spent 40µs (16+24) within Opcode::BEGIN@5 which was called:
# once (16µs+24µs) by Safe::BEGIN@46 at line 5 # spent 40µs making 1 call to Opcode::BEGIN@5
# spent 24µs making 1 call to strict::import |
| 6 | |||||
| 7 | 1 | 600ns | our($VERSION, @ISA, @EXPORT_OK); | ||
| 8 | |||||
| 9 | 1 | 700ns | $VERSION = "1.23"; | ||
| 10 | |||||
| 11 | 2 | 29µs | 2 | 119µs | # spent 66µs (13+53) within Opcode::BEGIN@11 which was called:
# once (13µs+53µs) by Safe::BEGIN@46 at line 11 # spent 66µs making 1 call to Opcode::BEGIN@11
# spent 53µs making 1 call to Exporter::import |
| 12 | 2 | 26µs | 1 | 5µs | # spent 5µs within Opcode::BEGIN@12 which was called:
# once (5µs+0s) by Safe::BEGIN@46 at line 12 # spent 5µs making 1 call to Opcode::BEGIN@12 |
| 13 | 2 | 56µs | 1 | 7µs | # spent 7µs within Opcode::BEGIN@13 which was called:
# once (7µs+0s) by Safe::BEGIN@46 at line 13 # spent 7µs making 1 call to Opcode::BEGIN@13 |
| 14 | |||||
| 15 | # spent 13µs within Opcode::BEGIN@15 which was called:
# once (13µs+0s) by Safe::BEGIN@46 at line 24 | ||||
| 16 | 1 | 6µs | @ISA = qw(Exporter); | ||
| 17 | 1 | 7µs | @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 | 41µs | 1 | 13µs | } # spent 13µs making 1 call to Opcode::BEGIN@15 |
| 25 | |||||
| 26 | sub opset (;@); | ||||
| 27 | sub opset_to_hex ($); | ||||
| 28 | sub opdump (;$); | ||||
| 29 | 2 | 560µs | 2 | 337µs | # spent 261µs (184+77) within Opcode::BEGIN@29 which was called:
# once (184µs+77µs) by Safe::BEGIN@46 at line 29 # spent 261µs making 1 call to Opcode::BEGIN@29
# spent 77µs making 1 call to subs::import |
| 30 | |||||
| 31 | 1 | 754µs | 1 | 742µs | XSLoader::load(); # spent 742µs making 1 call to XSLoader::load |
| 32 | |||||
| 33 | 1 | 3µs | 1 | 2.22ms | _init_optags(); # spent 2.22ms 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 2.22ms (1.84+375µs) within Opcode::_init_optags which was called:
# once (1.84ms+375µs) by Safe::BEGIN@46 at line 33 | ||||
| 55 | 1 | 400ns | my(%all, %seen); | ||
| 56 | 1 | 140µs | 2 | 45µs | @all{opset_to_ops(full_opset)} = (); # keys only # spent 43µs making 1 call to Opcode::opset_to_ops
# spent 2µs making 1 call to Opcode::full_opset |
| 57 | |||||
| 58 | 1 | 500ns | local($_); | ||
| 59 | 1 | 3µs | local($/) = "\n=cut"; # skip to optags definition section | ||
| 60 | 1 | 43µs | 1 | 36µs | <DATA>; # spent 36µs making 1 call to Opcode::CORE:readline |
| 61 | 1 | 1µs | $/ = "\n="; # now read in 'pod section' chunks | ||
| 62 | 1 | 26µs | 8 | 11µs | while(<DATA>) { # spent 11µs making 8 calls to Opcode::CORE:readline, avg 1µs/call |
| 63 | 26 | 90µs | 26 | 44µs | next unless m/^item\s+(:\w+)/; # spent 44µs making 26 calls to Opcode::CORE:match, avg 2µs/call |
| 64 | 19 | 18µs | my $tag = $1; | ||
| 65 | |||||
| 66 | # Split into lines, keep only indented lines | ||||
| 67 | 309 | 794µs | 290 | 84µs | my @lines = grep { m/^\s/ } split(/\n/); # spent 84µs making 290 calls to Opcode::CORE:match, avg 290ns/call |
| 68 | 120 | 224µs | 101 | 43µs | foreach (@lines) { s/--.*// } # delete comments # spent 43µs making 101 calls to Opcode::CORE:subst, avg 430ns/call |
| 69 | 120 | 157µs | my @ops = map { split ' ' } @lines; # get op words | ||
| 70 | |||||
| 71 | 19 | 11µs | foreach(@ops) { | ||
| 72 | 382 | 76µs | warn "$tag - $_ already tagged in $seen{$_}\n" if $seen{$_}; | ||
| 73 | 382 | 173µs | $seen{$_} = $tag; | ||
| 74 | 382 | 152µs | delete $all{$_}; | ||
| 75 | } | ||||
| 76 | # opset will croak on invalid names | ||||
| 77 | 19 | 249µs | 57 | 103µs | define_optag($tag, opset(@ops)); # spent 64µs making 19 calls to Opcode::opset, avg 3µs/call
# spent 22µs making 19 calls to Opcode::define_optag, avg 1µs/call
# spent 18µs making 19 calls to Opcode::CORE:readline, avg 947ns/call |
| 78 | } | ||||
| 79 | 1 | 24µs | 1 | 8µs | close(DATA); # spent 8µs making 1 call to Opcode::CORE:close |
| 80 | 1 | 40µs | warn "Untagged opnames: ".join(' ',keys %all)."\n" if %all; | ||
| 81 | } | ||||
| 82 | |||||
| 83 | |||||
| 84 | 1 | 7µs | 1; | ||
| 85 | |||||
| 86 | __DATA__ | ||||
# spent 8µs within Opcode::CORE:close which was called:
# once (8µs+0s) by Opcode::_init_optags at line 79 | |||||
sub Opcode::CORE:match; # opcode | |||||
sub Opcode::CORE:readline; # opcode | |||||
# spent 43µs within Opcode::CORE:subst which was called 101 times, avg 430ns/call:
# 101 times (43µs+0s) by Opcode::_init_optags at line 68, avg 430ns/call | |||||
# spent 173µs (49+124) within Opcode::_safe_call_sv which was called 2 times, avg 87µs/call:
# 2 times (49µs+124µs) by Safe::reval at line 360 of Safe.pm, avg 87µs/call | |||||
# spent 6µs within Opcode::_safe_pkg_prep which was called:
# once (6µs+0s) by Safe::new at line 173 of Safe.pm | |||||
# spent 22µs within Opcode::define_optag which was called 19 times, avg 1µs/call:
# 19 times (22µs+0s) by Opcode::_init_optags at line 77, avg 1µs/call | |||||
# spent 2µs within Opcode::full_opset which was called:
# once (2µs+0s) by Opcode::_init_optags at line 56 | |||||
# spent 2µs within Opcode::invert_opset which was called 2 times, avg 1µs/call:
# once (1µs+0s) by Safe::permit_only at line 259 of Safe.pm
# once (1µs+0s) by Safe::permit at line 255 of Safe.pm | |||||
# spent 67µs within Opcode::opset which was called 21 times, avg 3µs/call:
# 19 times (64µs+0s) by Opcode::_init_optags at line 77, avg 3µs/call
# once (2µs+0s) by Safe::permit_only at line 259 of Safe.pm
# once (1µs+0s) by Safe::permit at line 255 of Safe.pm | |||||
# spent 43µs within Opcode::opset_to_ops which was called:
# once (43µs+0s) by Opcode::_init_optags at line 56 |