| Filename | /home/lbr/.plenv/versions/5.20.2/lib/perl5/5.20.2/x86_64-linux/Encode/Encoding.pm |
| Statements | Executed 700 statements in 1.39ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 50 | 1 | 1 | 434µs | 500µs | Encode::Encoding::renew |
| 340 | 1 | 1 | 270µs | 270µs | Encode::Encoding::renewed |
| 50 | 1 | 1 | 66µs | 66µs | Encode::Encoding::DEBUG |
| 50 | 1 | 1 | 56µs | 56µs | Encode::Encoding::needs_lines |
| 1 | 1 | 1 | 11µs | 24µs | Encode::Encoding::BEGIN@4 |
| 1 | 1 | 1 | 5µs | 9µs | Encode::Encoding::BEGIN@5 |
| 1 | 1 | 1 | 3µs | 3µs | Encode::Encoding::CORE:match (opcode) |
| 0 | 0 | 0 | 0s | 0s | Encode::Encoding::DESTROY |
| 0 | 0 | 0 | 0s | 0s | Encode::Encoding::Define |
| 0 | 0 | 0 | 0s | 0s | Encode::Encoding::decode |
| 0 | 0 | 0 | 0s | 0s | Encode::Encoding::encode |
| 0 | 0 | 0 | 0s | 0s | Encode::Encoding::fromUnicode |
| 0 | 0 | 0 | 0s | 0s | Encode::Encoding::mime_name |
| 0 | 0 | 0 | 0s | 0s | Encode::Encoding::name |
| 0 | 0 | 0 | 0s | 0s | Encode::Encoding::perlio_ok |
| 0 | 0 | 0 | 0s | 0s | Encode::Encoding::toUnicode |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Encode::Encoding; | ||||
| 2 | |||||
| 3 | # Base class for classes which implement encodings | ||||
| 4 | 2 | 30µs | 2 | 37µs | # spent 24µs (11+13) within Encode::Encoding::BEGIN@4 which was called:
# once (11µs+13µs) by Encode::predefine_encodings at line 4 # spent 24µs making 1 call to Encode::Encoding::BEGIN@4
# spent 13µs making 1 call to strict::import |
| 5 | 2 | 259µs | 2 | 12µs | # spent 9µs (5+4) within Encode::Encoding::BEGIN@5 which was called:
# once (5µs+4µs) by Encode::predefine_encodings at line 5 # spent 9µs making 1 call to Encode::Encoding::BEGIN@5
# spent 4µs making 1 call to warnings::import |
| 6 | 3 | 14µs | 1 | 3µs | our $VERSION = do { my @r = ( q$Revision: 2.7 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; # spent 3µs making 1 call to Encode::Encoding::CORE:match |
| 7 | |||||
| 8 | 1 | 500ns | require Encode; | ||
| 9 | |||||
| 10 | 50 | 102µs | # spent 66µs within Encode::Encoding::DEBUG which was called 50 times, avg 1µs/call:
# 50 times (66µs+0s) by Encode::Encoding::renew at line 34, avg 1µs/call | ||
| 11 | |||||
| 12 | sub Define { | ||||
| 13 | my $obj = shift; | ||||
| 14 | my $canonical = shift; | ||||
| 15 | $obj = bless { Name => $canonical }, $obj unless ref $obj; | ||||
| 16 | |||||
| 17 | # warn "$canonical => $obj\n"; | ||||
| 18 | Encode::define_encoding( $obj, $canonical, @_ ); | ||||
| 19 | } | ||||
| 20 | |||||
| 21 | sub name { return shift->{'Name'} } | ||||
| 22 | |||||
| 23 | sub mime_name{ | ||||
| 24 | require Encode::MIME::Name; | ||||
| 25 | return Encode::MIME::Name::get_mime_name(shift->name); | ||||
| 26 | } | ||||
| 27 | |||||
| 28 | # sub renew { return $_[0] } | ||||
| 29 | |||||
| 30 | # spent 500µs (434+66) within Encode::Encoding::renew which was called 50 times, avg 10µs/call:
# 50 times (434µs+66µs) by main::CORE:open at line 53 of opt.pl, avg 10µs/call | ||||
| 31 | 50 | 16µs | my $self = shift; | ||
| 32 | 50 | 184µs | my $clone = bless {%$self} => ref($self); | ||
| 33 | 50 | 44µs | $clone->{renewed}++; # so the caller can see it | ||
| 34 | 50 | 80µs | 50 | 66µs | DEBUG and warn $clone->{renewed}; # spent 66µs making 50 calls to Encode::Encoding::DEBUG, avg 1µs/call |
| 35 | 50 | 86µs | return $clone; | ||
| 36 | } | ||||
| 37 | |||||
| 38 | 340 | 493µs | # spent 270µs within Encode::Encoding::renewed which was called 340 times, avg 794ns/call:
# 340 times (270µs+0s) by Encode::utf8::decode_xs at line 54 of opt.pl, avg 794ns/call | ||
| 39 | |||||
| 40 | 1 | 800ns | *new_sequence = \&renew; | ||
| 41 | |||||
| 42 | 50 | 75µs | # spent 56µs within Encode::Encoding::needs_lines which was called 50 times, avg 1µs/call:
# 50 times (56µs+0s) by main::CORE:open at line 53 of opt.pl, avg 1µs/call | ||
| 43 | |||||
| 44 | sub perlio_ok { | ||||
| 45 | eval { require PerlIO::encoding }; | ||||
| 46 | return $@ ? 0 : 1; | ||||
| 47 | } | ||||
| 48 | |||||
| 49 | # (Temporary|legacy) methods | ||||
| 50 | |||||
| 51 | sub toUnicode { shift->decode(@_) } | ||||
| 52 | sub fromUnicode { shift->encode(@_) } | ||||
| 53 | |||||
| 54 | # | ||||
| 55 | # Needs to be overloaded or just croak | ||||
| 56 | # | ||||
| 57 | |||||
| 58 | sub encode { | ||||
| 59 | require Carp; | ||||
| 60 | my $obj = shift; | ||||
| 61 | my $class = ref($obj) ? ref($obj) : $obj; | ||||
| 62 | Carp::croak( $class . "->encode() not defined!" ); | ||||
| 63 | } | ||||
| 64 | |||||
| 65 | sub decode { | ||||
| 66 | require Carp; | ||||
| 67 | my $obj = shift; | ||||
| 68 | my $class = ref($obj) ? ref($obj) : $obj; | ||||
| 69 | Carp::croak( $class . "->encode() not defined!" ); | ||||
| 70 | } | ||||
| 71 | |||||
| 72 | sub DESTROY { } | ||||
| 73 | |||||
| 74 | 1 | 4µs | 1; | ||
| 75 | __END__ | ||||
# spent 3µs within Encode::Encoding::CORE:match which was called:
# once (3µs+0s) by Encode::predefine_encodings at line 6 |