| Filename | /home/ss5/perl5/perlbrew/perls/tapper-perl/lib/5.16.3/x86_64-linux/Opcode.pm |
| Statements | Executed 1806 statements in 2.59ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 1.24ms | 1.50ms | Opcode::_init_optags |
| 1 | 1 | 1 | 120µs | 171µs | Opcode::BEGIN@29 |
| 316 | 2 | 1 | 84µs | 84µs | Opcode::CORE:match (opcode) |
| 21 | 3 | 2 | 50µs | 50µs | Opcode::opset (xsub) |
| 28 | 3 | 1 | 43µs | 43µs | Opcode::CORE:readline (opcode) |
| 1 | 1 | 1 | 32µs | 32µs | Opcode::opset_to_ops (xsub) |
| 101 | 1 | 1 | 28µs | 28µs | Opcode::CORE:subst (opcode) |
| 19 | 1 | 1 | 16µs | 16µs | Opcode::define_optag (xsub) |
| 1 | 1 | 1 | 14µs | 14µs | Opcode::BEGIN@3 |
| 1 | 1 | 1 | 9µs | 9µs | Opcode::BEGIN@15 |
| 1 | 1 | 1 | 9µs | 42µs | Opcode::BEGIN@11 |
| 1 | 1 | 1 | 8µs | 8µs | Opcode::_safe_pkg_prep (xsub) |
| 1 | 1 | 1 | 8µs | 8µs | Opcode::CORE:close (opcode) |
| 1 | 1 | 1 | 7µs | 17µs | Opcode::BEGIN@5 |
| 1 | 1 | 1 | 4µs | 4µs | Opcode::BEGIN@13 |
| 1 | 1 | 1 | 3µs | 3µs | Opcode::BEGIN@12 |
| 2 | 2 | 1 | 3µs | 3µs | Opcode::invert_opset (xsub) |
| 1 | 1 | 1 | 1µs | 1µ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 | 40µs | 1 | 14µs | # spent 14µs within Opcode::BEGIN@3 which was called:
# once (14µs+0s) by Safe::BEGIN@46 at line 3 # spent 14µs making 1 call to Opcode::BEGIN@3 |
| 4 | |||||
| 5 | 2 | 357µs | 2 | 27µs | # spent 17µs (7+10) within Opcode::BEGIN@5 which was called:
# once (7µs+10µs) by Safe::BEGIN@46 at line 5 # spent 17µs making 1 call to Opcode::BEGIN@5
# spent 10µs making 1 call to strict::import |
| 6 | |||||
| 7 | 1 | 400ns | our($VERSION, @ISA, @EXPORT_OK); | ||
| 8 | |||||
| 9 | 1 | 400ns | $VERSION = "1.23"; | ||
| 10 | |||||
| 11 | 2 | 19µs | 2 | 74µs | # spent 42µs (9+32) within Opcode::BEGIN@11 which was called:
# once (9µs+32µs) by Safe::BEGIN@46 at line 11 # spent 42µs making 1 call to Opcode::BEGIN@11
# spent 32µs making 1 call to Exporter::import |
| 12 | 2 | 14µs | 1 | 3µs | # spent 3µs within Opcode::BEGIN@12 which was called:
# once (3µs+0s) by Safe::BEGIN@46 at line 12 # spent 3µs making 1 call to Opcode::BEGIN@12 |
| 13 | 2 | 33µs | 1 | 4µs | # spent 4µs within Opcode::BEGIN@13 which was called:
# once (4µs+0s) by Safe::BEGIN@46 at line 13 # spent 4µs making 1 call to Opcode::BEGIN@13 |
| 14 | |||||
| 15 | # spent 9µs within Opcode::BEGIN@15 which was called:
# once (9µs+0s) by Safe::BEGIN@46 at line 24 | ||||
| 16 | 1 | 5µs | @ISA = qw(Exporter); | ||
| 17 | 1 | 5µ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 | 27µs | 1 | 9µs | } # spent 9µs making 1 call to Opcode::BEGIN@15 |
| 25 | |||||
| 26 | sub opset (;@); | ||||
| 27 | sub opset_to_hex ($); | ||||
| 28 | sub opdump (;$); | ||||
| 29 | 2 | 361µs | 2 | 222µs | # spent 171µs (120+51) within Opcode::BEGIN@29 which was called:
# once (120µs+51µs) by Safe::BEGIN@46 at line 29 # spent 171µs making 1 call to Opcode::BEGIN@29
# spent 51µs making 1 call to subs::import |
| 30 | |||||
| 31 | 1 | 219µs | 1 | 212µs | XSLoader::load(); # spent 212µs making 1 call to XSLoader::load |
| 32 | |||||
| 33 | 1 | 1µs | 1 | 1.50ms | _init_optags(); # spent 1.50ms 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 1.50ms (1.24+260µs) within Opcode::_init_optags which was called:
# once (1.24ms+260µs) by Safe::BEGIN@46 at line 33 | ||||
| 55 | 1 | 200ns | my(%all, %seen); | ||
| 56 | 1 | 99µs | 2 | 34µs | @all{opset_to_ops(full_opset)} = (); # keys only # spent 32µs making 1 call to Opcode::opset_to_ops
# spent 1µs making 1 call to Opcode::full_opset |
| 57 | |||||
| 58 | 1 | 200ns | local($_); | ||
| 59 | 1 | 2µs | local($/) = "\n=cut"; # skip to optags definition section | ||
| 60 | 1 | 28µs | 1 | 22µs | <DATA>; # spent 22µs making 1 call to Opcode::CORE:readline |
| 61 | 1 | 800ns | $/ = "\n="; # now read in 'pod section' chunks | ||
| 62 | 1 | 18µs | 8 | 8µs | while(<DATA>) { # spent 8µs making 8 calls to Opcode::CORE:readline, avg 950ns/call |
| 63 | 26 | 63µs | 26 | 30µs | next unless m/^item\s+(:\w+)/; # spent 30µs making 26 calls to Opcode::CORE:match, avg 1µs/call |
| 64 | 19 | 13µs | my $tag = $1; | ||
| 65 | |||||
| 66 | # Split into lines, keep only indented lines | ||||
| 67 | 309 | 495µs | 290 | 54µs | my @lines = grep { m/^\s/ } split(/\n/); # spent 54µs making 290 calls to Opcode::CORE:match, avg 186ns/call |
| 68 | 120 | 146µs | 101 | 28µs | foreach (@lines) { s/--.*// } # delete comments # spent 28µs making 101 calls to Opcode::CORE:subst, avg 281ns/call |
| 69 | 120 | 105µs | my @ops = map { split ' ' } @lines; # get op words | ||
| 70 | |||||
| 71 | 19 | 8µs | foreach(@ops) { | ||
| 72 | 382 | 52µs | warn "$tag - $_ already tagged in $seen{$_}\n" if $seen{$_}; | ||
| 73 | 382 | 132µs | $seen{$_} = $tag; | ||
| 74 | 382 | 107µs | delete $all{$_}; | ||
| 75 | } | ||||
| 76 | # opset will croak on invalid names | ||||
| 77 | 19 | 185µs | 57 | 76µs | define_optag($tag, opset(@ops)); # spent 47µs making 19 calls to Opcode::opset, avg 2µs/call
# spent 16µs making 19 calls to Opcode::define_optag, avg 842ns/call
# spent 13µs making 19 calls to Opcode::CORE:readline, avg 684ns/call |
| 78 | } | ||||
| 79 | 1 | 13µs | 1 | 8µs | close(DATA); # spent 8µs making 1 call to Opcode::CORE:close |
| 80 | 1 | 32µs | warn "Untagged opnames: ".join(' ',keys %all)."\n" if %all; | ||
| 81 | } | ||||
| 82 | |||||
| 83 | |||||
| 84 | 1 | 6µ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 28µs within Opcode::CORE:subst which was called 101 times, avg 281ns/call:
# 101 times (28µs+0s) by Opcode::_init_optags at line 68, avg 281ns/call | |||||
# spent 8µs within Opcode::_safe_pkg_prep which was called:
# once (8µs+0s) by Safe::new at line 173 of Safe.pm | |||||
# spent 16µs within Opcode::define_optag which was called 19 times, avg 842ns/call:
# 19 times (16µs+0s) by Opcode::_init_optags at line 77, avg 842ns/call | |||||
# spent 1µs within Opcode::full_opset which was called:
# once (1µs+0s) by Opcode::_init_optags at line 56 | |||||
# spent 3µs within Opcode::invert_opset which was called 2 times, avg 1µs/call:
# once (1µs+0s) by Safe::permit at line 255 of Safe.pm
# once (1µs+0s) by Safe::permit_only at line 259 of Safe.pm | |||||
# spent 50µs within Opcode::opset which was called 21 times, avg 2µs/call:
# 19 times (47µs+0s) by Opcode::_init_optags at line 77, avg 2µs/call
# once (2µs+0s) by Safe::permit_only at line 259 of Safe.pm
# once (2µs+0s) by Safe::permit at line 255 of Safe.pm | |||||
# spent 32µs within Opcode::opset_to_ops which was called:
# once (32µs+0s) by Opcode::_init_optags at line 56 |