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 |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 7.14ms | 8.80ms | _init_optags | Opcode::
1 | 1 | 1 | 751µs | 1.05ms | BEGIN@29 | Opcode::
316 | 2 | 1 | 637µs | 637µs | CORE:match (opcode) | Opcode::
21 | 3 | 2 | 262µs | 262µs | opset (xsub) | Opcode::
28 | 3 | 1 | 237µs | 237µs | CORE:readline (opcode) | Opcode::
101 | 1 | 1 | 220µs | 220µs | CORE:subst (opcode) | Opcode::
1 | 1 | 1 | 187µs | 187µs | opset_to_ops (xsub) | Opcode::
1 | 1 | 1 | 104µs | 104µs | BEGIN@3 | Opcode::
19 | 1 | 1 | 92µs | 92µs | define_optag (xsub) | Opcode::
1 | 1 | 1 | 46µs | 46µs | BEGIN@15 | Opcode::
1 | 1 | 1 | 32µs | 229µs | BEGIN@11 | Opcode::
1 | 1 | 1 | 31µs | 46µs | BEGIN@5 | Opcode::
1 | 1 | 1 | 30µs | 30µs | CORE:close (opcode) | Opcode::
1 | 1 | 1 | 27µs | 27µs | _safe_pkg_prep (xsub) | Opcode::
1 | 1 | 1 | 23µs | 23µs | BEGIN@13 | Opcode::
1 | 1 | 1 | 14µs | 14µs | BEGIN@12 | Opcode::
1 | 1 | 1 | 12µs | 12µs | full_opset (xsub) | Opcode::
2 | 2 | 1 | 10µs | 10µs | invert_opset (xsub) | Opcode::
0 | 0 | 0 | 0s | 0s | opdump | Opcode::
0 | 0 | 0 | 0s | 0s | ops_to_opset | Opcode::
0 | 0 | 0 | 0s | 0s | opset_to_hex | Opcode::
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 # 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 # 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 # 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 # 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 # 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 | ||||
16 | 1 | 23µs | @ISA = qw(Exporter); | ||
17 | 1 | 52µ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 | 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 # 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 | ||||
55 | 1 | 2µs | my(%all, %seen); | ||
56 | 1 | 579µs | 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 | 1 | 2µs | local($_); | ||
59 | 1 | 15µs | local($/) = "\n=cut"; # skip to optags definition section | ||
60 | 1 | 145µs | 1 | 122µs | <DATA>; # spent 122µs making 1 call to Opcode::CORE:readline |
61 | 1 | 5µs | $/ = "\n="; # now read in 'pod section' chunks | ||
62 | 1 | 96µs | 8 | 41µs | while(<DATA>) { # spent 41µs making 8 calls to Opcode::CORE:readline, avg 5µs/call |
63 | 26 | 322µs | 26 | 166µs | next unless m/^item\s+(:\w+)/; # spent 166µs making 26 calls to Opcode::CORE:match, avg 6µs/call |
64 | 19 | 72µs | my $tag = $1; | ||
65 | |||||
66 | # Split into lines, keep only indented lines | ||||
67 | 309 | 3.03ms | 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 | 120 | 894µs | 101 | 220µs | foreach (@lines) { s/--.*// } # delete comments # spent 220µs making 101 calls to Opcode::CORE:subst, avg 2µs/call |
69 | 120 | 599µs | my @ops = map { split ' ' } @lines; # get op words | ||
70 | |||||
71 | 19 | 43µs | foreach(@ops) { | ||
72 | 378 | 327µs | warn "$tag - $_ already tagged in $seen{$_}\n" if $seen{$_}; | ||
73 | 378 | 911µs | $seen{$_} = $tag; | ||
74 | 378 | 635µs | delete $all{$_}; | ||
75 | } | ||||
76 | # opset will croak on invalid names | ||||
77 | 19 | 909µs | 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 | 51µs | 1 | 30µs | close(DATA); # spent 30µs making 1 call to Opcode::CORE:close |
80 | 1 | 159µs | 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:match; # opcode | |||||
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 | |||||
# spent 27µs within Opcode::_safe_pkg_prep which was called:
# once (27µs+0s) by Safe::new at line 176 of Safe.pm | |||||
# 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 | |||||
# spent 12µs within Opcode::full_opset which was called:
# once (12µs+0s) by Opcode::_init_optags at line 56 | |||||
# 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 | |||||
# 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 | |||||
# spent 187µs within Opcode::opset_to_ops which was called:
# once (187µs+0s) by Opcode::_init_optags at line 56 |