| Filename | /usr/lib/perl/5.10/IO/File.pm |
| Statements | Executed 62 statements in 2.31ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 2.85ms | 3.07ms | IO::File::BEGIN@12 |
| 1 | 1 | 1 | 1.32ms | 1.39ms | IO::File::BEGIN@8 |
| 1 | 1 | 1 | 991µs | 1.11ms | IO::File::BEGIN@9 |
| 1 | 1 | 1 | 557µs | 7.34ms | IO::File::BEGIN@11 |
| 1 | 1 | 1 | 414µs | 644µs | IO::File::BEGIN@10 |
| 3 | 1 | 1 | 207µs | 207µs | IO::File::CORE:open (opcode) |
| 3 | 2 | 2 | 110µs | 354µs | IO::File::new |
| 3 | 2 | 2 | 52µs | 259µs | IO::File::open |
| 68 | 1 | 1 | 44µs | 44µs | IO::File::CORE:match (opcode) |
| 1 | 1 | 1 | 25µs | 25µs | IO::File::BEGIN@5 |
| 1 | 1 | 1 | 10µs | 15µs | IO::File::BEGIN@6 |
| 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 | 3 | 41µs | 1 | 25µs | # spent 25µs within IO::File::BEGIN@5 which was called:
# once (25µs+0s) by Storable::BEGIN@23 at line 5 # spent 25µs making 1 call to IO::File::BEGIN@5 |
| 6 | 3 | 92µs | 2 | 19µs | # spent 15µs (10+4) within IO::File::BEGIN@6 which was called:
# once (10µs+4µs) by Storable::BEGIN@23 at line 6 # spent 15µs making 1 call to IO::File::BEGIN@6
# spent 4µs making 1 call to strict::import |
| 7 | 1 | 1µs | our($VERSION, @EXPORT, @EXPORT_OK, @ISA); | ||
| 8 | 3 | 470µs | 2 | 1.46ms | # spent 1.39ms (1.32+72µs) within IO::File::BEGIN@8 which was called:
# once (1.32ms+72µs) by Storable::BEGIN@23 at line 8 # spent 1.39ms making 1 call to IO::File::BEGIN@8
# spent 72µs making 1 call to Exporter::import |
| 9 | 3 | 173µs | 2 | 1.21ms | # spent 1.11ms (991µs+121µs) within IO::File::BEGIN@9 which was called:
# once (991µs+121µs) by Storable::BEGIN@23 at line 9 # spent 1.11ms making 1 call to IO::File::BEGIN@9
# spent 97µs making 1 call to Exporter::import |
| 10 | 3 | 244µs | 1 | 644µs | # spent 644µs (414+230) within IO::File::BEGIN@10 which was called:
# once (414µs+230µs) by Storable::BEGIN@23 at line 10 # spent 644µs making 1 call to IO::File::BEGIN@10 |
| 11 | 3 | 171µs | 2 | 7.41ms | # spent 7.34ms (557µs+6.79) within IO::File::BEGIN@11 which was called:
# once (557µs+6.79ms) by Storable::BEGIN@23 at line 11 # spent 7.34ms making 1 call to IO::File::BEGIN@11
# spent 71µs making 1 call to Exporter::import |
| 12 | 3 | 511µs | 1 | 3.07ms | # spent 3.07ms (2.85+212µs) within IO::File::BEGIN@12 which was called:
# once (2.85ms+212µs) by Storable::BEGIN@23 at line 12 # spent 3.07ms making 1 call to IO::File::BEGIN@12 |
| 13 | |||||
| 14 | 1 | 700ns | require Exporter; | ||
| 15 | |||||
| 16 | 1 | 22µs | @ISA = qw(IO::Handle IO::Seekable Exporter); | ||
| 17 | |||||
| 18 | 1 | 500ns | $VERSION = "1.14"; | ||
| 19 | |||||
| 20 | 1 | 1µs | @EXPORT = @IO::Seekable::EXPORT; | ||
| 21 | |||||
| 22 | 1 | 1µs | eval { | ||
| 23 | # Make all Fcntl O_XXX constants available for importing | ||||
| 24 | 1 | 900ns | require Fcntl; | ||
| 25 | 1 | 170µs | 68 | 44µs | my @O = grep /^O_/, @Fcntl::EXPORT; # spent 44µs making 68 calls to IO::File::CORE:match, avg 649ns/call |
| 26 | 1 | 9µs | 1 | 288µs | Fcntl->import(@O); # first we import what we want to export # spent 288µs making 1 call to Exporter::import |
| 27 | 1 | 19µs | push(@EXPORT, @O); | ||
| 28 | }; | ||||
| 29 | |||||
| 30 | ################################################ | ||||
| 31 | ## Constructor | ||||
| 32 | ## | ||||
| 33 | |||||
| 34 | # spent 354µs (110+244) within IO::File::new which was called 3 times, avg 118µs/call:
# 2 times (76µs+55µs) by Date::Manip::TZ::_get_curr_zone at line 415 of Date/Manip/TZ.pm, avg 66µs/call
# once (34µs+189µs) by ZOOM::Query::CCL2RPN::new at line 642 of ZOOM.pm | ||||
| 35 | 3 | 5µs | my $type = shift; | ||
| 36 | 3 | 5µs | my $class = ref($type) || $type || "IO::File"; | ||
| 37 | 3 | 12µs | @_ >= 0 && @_ <= 3 | ||
| 38 | or croak "usage: new $class [FILENAME [,MODE [,PERMS]]]"; | ||||
| 39 | 3 | 63µs | 3 | 87µs | my $fh = $class->SUPER::new(); # spent 87µs making 3 calls to IO::Handle::new, avg 29µs/call |
| 40 | 3 | 7µs | 1 | 158µs | if (@_) { # spent 158µs making 1 call to IO::File::open |
| 41 | $fh->open(@_) | ||||
| 42 | or return undef; | ||||
| 43 | } | ||||
| 44 | 3 | 10µs | $fh; | ||
| 45 | } | ||||
| 46 | |||||
| 47 | ################################################ | ||||
| 48 | ## Open | ||||
| 49 | ## | ||||
| 50 | |||||
| 51 | # spent 259µs (52+207) within IO::File::open which was called 3 times, avg 86µs/call:
# 2 times (35µs+66µs) by Date::Manip::TZ::_get_curr_zone at line 416 of Date/Manip/TZ.pm, avg 51µs/call
# once (17µs+140µs) by IO::File::new at line 40 | ||||
| 52 | 3 | 5µs | @_ >= 2 && @_ <= 4 or croak 'usage: $fh->open(FILENAME [,MODE [,PERMS]])'; | ||
| 53 | 3 | 5µs | my ($fh, $file) = @_; | ||
| 54 | 3 | 3µs | if (@_ > 2) { | ||
| 55 | my ($mode, $perms) = @_[2, 3]; | ||||
| 56 | if ($mode =~ /^\d+$/) { | ||||
| 57 | defined $perms or $perms = 0666; | ||||
| 58 | return sysopen($fh, $file, $mode, $perms); | ||||
| 59 | } elsif ($mode =~ /:/) { | ||||
| 60 | return open($fh, $mode, $file) if @_ == 3; | ||||
| 61 | croak 'usage: $fh->open(FILENAME, IOLAYERS)'; | ||||
| 62 | } else { | ||||
| 63 | return open($fh, IO::Handle::_open_mode_string($mode), $file); | ||||
| 64 | } | ||||
| 65 | } | ||||
| 66 | 3 | 255µs | 3 | 207µs | open($fh, $file); # spent 207µs making 3 calls to IO::File::CORE:open, avg 69µs/call |
| 67 | } | ||||
| 68 | |||||
| 69 | ################################################ | ||||
| 70 | ## Binmode | ||||
| 71 | ## | ||||
| 72 | |||||
| 73 | sub binmode { | ||||
| 74 | ( @_ == 1 or @_ == 2 ) or croak 'usage $fh->binmode([LAYER])'; | ||||
| 75 | |||||
| 76 | my($fh, $layer) = @_; | ||||
| 77 | |||||
| 78 | return binmode $$fh unless $layer; | ||||
| 79 | return binmode $$fh, $layer; | ||||
| 80 | } | ||||
| 81 | |||||
| 82 | 1 | 12µs | 1; | ||
# spent 44µs within IO::File::CORE:match which was called 68 times, avg 649ns/call:
# 68 times (44µs+0s) by Storable::BEGIN@23 at line 25, avg 649ns/call | |||||
# spent 207µs within IO::File::CORE:open which was called 3 times, avg 69µs/call:
# 3 times (207µs+0s) by IO::File::open at line 66, avg 69µs/call |