Filename | /usr/lib/perl/5.10/IO/File.pm |
Statements | Executed 62 statements in 1.86ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 2.04ms | 2.23ms | BEGIN@12 | IO::File::
1 | 1 | 1 | 946µs | 1.05ms | BEGIN@9 | IO::File::
1 | 1 | 1 | 629µs | 6.62ms | BEGIN@11 | IO::File::
1 | 1 | 1 | 360µs | 524µs | BEGIN@10 | IO::File::
3 | 1 | 1 | 244µs | 244µs | CORE:open (opcode) | IO::File::
3 | 2 | 2 | 118µs | 482µs | new | IO::File::
3 | 2 | 2 | 75µs | 319µs | open | IO::File::
1 | 1 | 1 | 42µs | 42µs | BEGIN@5 | IO::File::
68 | 1 | 1 | 41µs | 41µs | CORE:match (opcode) | IO::File::
1 | 1 | 1 | 25µs | 106µs | BEGIN@8 | IO::File::
1 | 1 | 1 | 13µs | 18µs | BEGIN@6 | IO::File::
0 | 0 | 0 | 0s | 0s | binmode | IO::File::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # | ||||
2 | |||||
3 | package IO::File; | ||||
4 | |||||
5 | 3 | 65µs | 1 | 42µs | # spent 42µs within IO::File::BEGIN@5 which was called:
# once (42µs+0s) by C4::Context::BEGIN@3 at line 5 # spent 42µs making 1 call to IO::File::BEGIN@5 |
6 | 3 | 79µs | 2 | 23µs | # spent 18µs (13+5) within IO::File::BEGIN@6 which was called:
# once (13µs+5µs) by C4::Context::BEGIN@3 at line 6 # spent 18µs making 1 call to IO::File::BEGIN@6
# spent 5µs making 1 call to strict::import |
7 | 1 | 1µs | our($VERSION, @EXPORT, @EXPORT_OK, @ISA); | ||
8 | 3 | 47µs | 2 | 188µs | # spent 106µs (25+81) within IO::File::BEGIN@8 which was called:
# once (25µs+81µs) by C4::Context::BEGIN@3 at line 8 # spent 106µs making 1 call to IO::File::BEGIN@8
# spent 81µs making 1 call to Exporter::import |
9 | 3 | 168µs | 2 | 1.13ms | # spent 1.05ms (946µs+107µs) within IO::File::BEGIN@9 which was called:
# once (946µs+107µs) by C4::Context::BEGIN@3 at line 9 # spent 1.05ms making 1 call to IO::File::BEGIN@9
# spent 75µs making 1 call to Exporter::import |
10 | 3 | 186µs | 1 | 524µs | # spent 524µs (360+165) within IO::File::BEGIN@10 which was called:
# once (360µs+165µs) by C4::Context::BEGIN@3 at line 10 # spent 524µs making 1 call to IO::File::BEGIN@10 |
11 | 3 | 166µs | 2 | 6.69ms | # spent 6.62ms (629µs+5.99) within IO::File::BEGIN@11 which was called:
# once (629µs+5.99ms) by C4::Context::BEGIN@3 at line 11 # spent 6.62ms making 1 call to IO::File::BEGIN@11
# spent 69µs making 1 call to Exporter::import |
12 | 3 | 516µs | 1 | 2.23ms | # spent 2.23ms (2.04+188µs) within IO::File::BEGIN@12 which was called:
# once (2.04ms+188µs) by C4::Context::BEGIN@3 at line 12 # spent 2.23ms making 1 call to IO::File::BEGIN@12 |
13 | |||||
14 | 1 | 1µs | require Exporter; | ||
15 | |||||
16 | 1 | 26µs | @ISA = qw(IO::Handle IO::Seekable Exporter); | ||
17 | |||||
18 | 1 | 400ns | $VERSION = "1.14"; | ||
19 | |||||
20 | 1 | 2µs | @EXPORT = @IO::Seekable::EXPORT; | ||
21 | |||||
22 | 5 | 158µs | eval { | ||
23 | # Make all Fcntl O_XXX constants available for importing | ||||
24 | require Fcntl; | ||||
25 | 68 | 41µs | my @O = grep /^O_/, @Fcntl::EXPORT; # spent 41µs making 68 calls to IO::File::CORE:match, avg 596ns/call | ||
26 | 1 | 208µs | Fcntl->import(@O); # first we import what we want to export # spent 208µs making 1 call to Exporter::import | ||
27 | push(@EXPORT, @O); | ||||
28 | }; | ||||
29 | |||||
30 | ################################################ | ||||
31 | ## Constructor | ||||
32 | ## | ||||
33 | |||||
34 | # spent 482µs (118+364) within IO::File::new which was called 3 times, avg 161µs/call:
# 2 times (81µs+71µs) by Date::Manip::TZ::_get_curr_zone at line 415 of Date/Manip/TZ.pm, avg 76µs/call
# once (37µs+293µs) by ZOOM::Query::CCL2RPN::new at line 642 of ZOOM.pm | ||||
35 | 18 | 111µs | my $type = shift; | ||
36 | my $class = ref($type) || $type || "IO::File"; | ||||
37 | @_ >= 0 && @_ <= 3 | ||||
38 | or croak "usage: new $class [FILENAME [,MODE [,PERMS]]]"; | ||||
39 | 3 | 141µs | my $fh = $class->SUPER::new(); # spent 141µs making 3 calls to IO::Handle::new, avg 47µs/call | ||
40 | 1 | 223µs | if (@_) { # spent 223µs making 1 call to IO::File::open | ||
41 | $fh->open(@_) | ||||
42 | or return undef; | ||||
43 | } | ||||
44 | $fh; | ||||
45 | } | ||||
46 | |||||
47 | ################################################ | ||||
48 | ## Open | ||||
49 | ## | ||||
50 | |||||
51 | # spent 319µs (75+244) within IO::File::open which was called 3 times, avg 106µs/call:
# 2 times (27µs+69µs) by Date::Manip::TZ::_get_curr_zone at line 416 of Date/Manip/TZ.pm, avg 48µs/call
# once (49µs+174µs) by IO::File::new at line 40 | ||||
52 | 12 | 324µs | @_ >= 2 && @_ <= 4 or croak 'usage: $fh->open(FILENAME [,MODE [,PERMS]])'; | ||
53 | my ($fh, $file) = @_; | ||||
54 | 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 | 244µs | open($fh, $file); # spent 244µs making 3 calls to IO::File::CORE:open, avg 81µ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 41µs within IO::File::CORE:match which was called 68 times, avg 596ns/call:
# 68 times (41µs+0s) by C4::Context::BEGIN@3 at line 25, avg 596ns/call | |||||
# spent 244µs within IO::File::CORE:open which was called 3 times, avg 81µs/call:
# 3 times (244µs+0s) by IO::File::open at line 66, avg 81µs/call |