| Filename | /usr/lib/x86_64-linux-gnu/perl/5.20/IO/File.pm |
| Statements | Executed 43 statements in 6.08ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 8.64ms | 9.01ms | IO::File::BEGIN@8 |
| 1 | 1 | 1 | 2.40ms | 2.47ms | IO::File::BEGIN@9 |
| 1 | 1 | 1 | 1.53ms | 10.6ms | IO::File::BEGIN@11 |
| 1 | 1 | 1 | 1.48ms | 1.59ms | IO::File::BEGIN@10 |
| 1 | 1 | 1 | 77µs | 95µs | IO::File::BEGIN@6 |
| 2 | 1 | 1 | 34µs | 34µs | IO::File::CORE:open (opcode) |
| 1 | 1 | 1 | 26µs | 26µs | IO::File::BEGIN@5 |
| 68 | 1 | 1 | 22µs | 22µs | IO::File::CORE:match (opcode) |
| 2 | 1 | 1 | 21µs | 50µs | IO::File::new |
| 2 | 1 | 1 | 18µs | 51µs | IO::File::open |
| 0 | 0 | 0 | 0s | 0s | IO::File::binmode |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # | ||||
| 2 | |||||
| 3 | package IO::File; | ||||
| 4 | |||||
| 5 | 2 | 66µs | 1 | 26µs | # spent 26µs within IO::File::BEGIN@5 which was called:
# once (26µs+0s) by Modern::Perl::BEGIN@16 at line 5 # spent 26µs making 1 call to IO::File::BEGIN@5 |
| 6 | 2 | 74µs | 2 | 113µs | # spent 95µs (77+18) within IO::File::BEGIN@6 which was called:
# once (77µs+18µs) by Modern::Perl::BEGIN@16 at line 6 # spent 95µs making 1 call to IO::File::BEGIN@6
# spent 18µs making 1 call to strict::import |
| 7 | 1 | 600ns | our($VERSION, @EXPORT, @EXPORT_OK, @ISA); | ||
| 8 | 2 | 1.49ms | 2 | 9.08ms | # spent 9.01ms (8.64+371µs) within IO::File::BEGIN@8 which was called:
# once (8.64ms+371µs) by Modern::Perl::BEGIN@16 at line 8 # spent 9.01ms making 1 call to IO::File::BEGIN@8
# spent 64µs making 1 call to Exporter::import |
| 9 | 2 | 1.30ms | 2 | 2.52ms | # spent 2.47ms (2.40+69µs) within IO::File::BEGIN@9 which was called:
# once (2.40ms+69µs) by Modern::Perl::BEGIN@16 at line 9 # spent 2.47ms making 1 call to IO::File::BEGIN@9
# spent 46µs making 1 call to Exporter::import |
| 10 | 2 | 1.33ms | 1 | 1.59ms | # spent 1.59ms (1.48+115µs) within IO::File::BEGIN@10 which was called:
# once (1.48ms+115µs) by Modern::Perl::BEGIN@16 at line 10 # spent 1.59ms making 1 call to IO::File::BEGIN@10 |
| 11 | 2 | 1.61ms | 2 | 10.7ms | # spent 10.6ms (1.53+9.10) within IO::File::BEGIN@11 which was called:
# once (1.53ms+9.10ms) by Modern::Perl::BEGIN@16 at line 11 # spent 10.6ms making 1 call to IO::File::BEGIN@11
# spent 36µs making 1 call to Exporter::import |
| 12 | |||||
| 13 | 1 | 900ns | require Exporter; | ||
| 14 | |||||
| 15 | 1 | 12µs | @ISA = qw(IO::Handle IO::Seekable Exporter); | ||
| 16 | |||||
| 17 | 1 | 300ns | $VERSION = "1.16"; | ||
| 18 | |||||
| 19 | 1 | 1µs | @EXPORT = @IO::Seekable::EXPORT; | ||
| 20 | |||||
| 21 | 1 | 600ns | eval { | ||
| 22 | # Make all Fcntl O_XXX constants available for importing | ||||
| 23 | 1 | 500ns | require Fcntl; | ||
| 24 | 1 | 106µs | 68 | 22µs | my @O = grep /^O_/, @Fcntl::EXPORT; # spent 22µs making 68 calls to IO::File::CORE:match, avg 318ns/call |
| 25 | 1 | 3µs | 1 | 138µs | Fcntl->import(@O); # first we import what we want to export # spent 138µs making 1 call to Exporter::import |
| 26 | 1 | 6µs | push(@EXPORT, @O); | ||
| 27 | }; | ||||
| 28 | |||||
| 29 | ################################################ | ||||
| 30 | ## Constructor | ||||
| 31 | ## | ||||
| 32 | |||||
| 33 | # spent 50µs (21+29) within IO::File::new which was called 2 times, avg 25µs/call:
# 2 times (21µs+29µs) by Date::Manip::TZ::_get_curr_zone at line 470 of Date/Manip/TZ.pm, avg 25µs/call | ||||
| 34 | 2 | 1µs | my $type = shift; | ||
| 35 | 2 | 1µs | my $class = ref($type) || $type || "IO::File"; | ||
| 36 | 2 | 2µs | @_ >= 0 && @_ <= 3 | ||
| 37 | or croak "usage: $class->new([FILENAME [,MODE [,PERMS]]])"; | ||||
| 38 | 2 | 8µs | 2 | 29µs | my $fh = $class->SUPER::new(); # spent 29µs making 2 calls to IO::Handle::new, avg 15µs/call |
| 39 | 2 | 800ns | if (@_) { | ||
| 40 | $fh->open(@_) | ||||
| 41 | or return undef; | ||||
| 42 | } | ||||
| 43 | 2 | 4µs | $fh; | ||
| 44 | } | ||||
| 45 | |||||
| 46 | ################################################ | ||||
| 47 | ## Open | ||||
| 48 | ## | ||||
| 49 | |||||
| 50 | # spent 51µs (18+34) within IO::File::open which was called 2 times, avg 26µs/call:
# 2 times (18µs+34µs) by Date::Manip::TZ::_get_curr_zone at line 471 of Date/Manip/TZ.pm, avg 26µs/call | ||||
| 51 | 2 | 2µs | @_ >= 2 && @_ <= 4 or croak 'usage: $fh->open(FILENAME [,MODE [,PERMS]])'; | ||
| 52 | 2 | 1µs | my ($fh, $file) = @_; | ||
| 53 | 2 | 800ns | if (@_ > 2) { | ||
| 54 | my ($mode, $perms) = @_[2, 3]; | ||||
| 55 | if ($mode =~ /^\d+$/) { | ||||
| 56 | defined $perms or $perms = 0666; | ||||
| 57 | return sysopen($fh, $file, $mode, $perms); | ||||
| 58 | } elsif ($mode =~ /:/) { | ||||
| 59 | return open($fh, $mode, $file) if @_ == 3; | ||||
| 60 | croak 'usage: $fh->open(FILENAME, IOLAYERS)'; | ||||
| 61 | } else { | ||||
| 62 | return open($fh, IO::Handle::_open_mode_string($mode), $file); | ||||
| 63 | } | ||||
| 64 | } | ||||
| 65 | 2 | 49µs | 2 | 34µs | open($fh, $file); # spent 34µs making 2 calls to IO::File::CORE:open, avg 17µs/call |
| 66 | } | ||||
| 67 | |||||
| 68 | ################################################ | ||||
| 69 | ## Binmode | ||||
| 70 | ## | ||||
| 71 | |||||
| 72 | sub binmode { | ||||
| 73 | ( @_ == 1 or @_ == 2 ) or croak 'usage $fh->binmode([LAYER])'; | ||||
| 74 | |||||
| 75 | my($fh, $layer) = @_; | ||||
| 76 | |||||
| 77 | return binmode $$fh unless $layer; | ||||
| 78 | return binmode $$fh, $layer; | ||||
| 79 | } | ||||
| 80 | |||||
| 81 | 1 | 8µs | 1; | ||
# spent 22µs within IO::File::CORE:match which was called 68 times, avg 318ns/call:
# 68 times (22µs+0s) by Modern::Perl::BEGIN@16 at line 24, avg 318ns/call | |||||
# spent 34µs within IO::File::CORE:open which was called 2 times, avg 17µs/call:
# 2 times (34µs+0s) by IO::File::open at line 65, avg 17µs/call |