← Index
NYTProf Performance Profile   « line view »
For script/ponapi
  Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:09 2016

Filename/usr/lib/perl/5.18/IO/File.pm
StatementsExecuted 47 statements in 751µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111288µs2.80msIO::File::::BEGIN@11IO::File::BEGIN@11
111185µs247µsIO::File::::BEGIN@10IO::File::BEGIN@10
21174µs288µsIO::File::::CORE:openIO::File::CORE:open (opcode)
21128µs352µsIO::File::::openIO::File::open
21119µs395µsIO::File::::newIO::File::new
722114µs14µsIO::File::::CORE:matchIO::File::CORE:match (opcode)
11111µs11µsIO::File::::BEGIN@5IO::File::BEGIN@5
1116µs36µsIO::File::::BEGIN@8IO::File::BEGIN@8
1116µs16µsIO::File::::BEGIN@6IO::File::BEGIN@6
1116µs29µsIO::File::::BEGIN@9IO::File::BEGIN@9
0000s0sIO::File::::binmodeIO::File::binmode
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1#
2
3package IO::File;
4
5233µs111µs
# spent 11µs within IO::File::BEGIN@5 which was called: # once (11µs+0s) by IO::Dir::BEGIN@15 at line 5
use 5.006_001;
# spent 11µs making 1 call to IO::File::BEGIN@5
6232µs226µs
# spent 16µs (6+10) within IO::File::BEGIN@6 which was called: # once (6µs+10µs) by IO::Dir::BEGIN@15 at line 6
use strict;
# spent 16µs making 1 call to IO::File::BEGIN@6 # spent 10µs making 1 call to strict::import
71300nsour($VERSION, @EXPORT, @EXPORT_OK, @ISA);
8222µs265µs
# spent 36µs (6+30) within IO::File::BEGIN@8 which was called: # once (6µs+30µs) by IO::Dir::BEGIN@15 at line 8
use Carp;
# spent 36µs making 1 call to IO::File::BEGIN@8 # spent 30µs making 1 call to Exporter::import
9218µs252µs
# spent 29µs (6+23) within IO::File::BEGIN@9 which was called: # once (6µs+23µs) by IO::Dir::BEGIN@15 at line 9
use Symbol;
# spent 29µs making 1 call to IO::File::BEGIN@9 # spent 23µs making 1 call to Exporter::import
10294µs1247µs
# spent 247µs (185+62) within IO::File::BEGIN@10 which was called: # once (185µs+62µs) by IO::Dir::BEGIN@15 at line 10
use SelectSaver;
# spent 247µs making 1 call to IO::File::BEGIN@10
112337µs22.82ms
# spent 2.80ms (288µs+2.51) within IO::File::BEGIN@11 which was called: # once (288µs+2.51ms) by IO::Dir::BEGIN@15 at line 11
use IO::Seekable;
# spent 2.80ms making 1 call to IO::File::BEGIN@11 # spent 24µs making 1 call to Exporter::import
12
131300nsrequire Exporter;
14
1518µs@ISA = qw(IO::Handle IO::Seekable Exporter);
16
171200ns$VERSION = "1.16";
18
191600ns@EXPORT = @IO::Seekable::EXPORT;
20
211300nseval {
22 # Make all Fcntl O_XXX constants available for importing
231300ns require Fcntl;
24171µs6811µs my @O = grep /^O_/, @Fcntl::EXPORT;
# spent 11µs making 68 calls to IO::File::CORE:match, avg 165ns/call
2512µs195µs Fcntl->import(@O); # first we import what we want to export
# spent 95µs making 1 call to Exporter::import
2618µs push(@EXPORT, @O);
27};
28
29################################################
30## Constructor
31##
32
33
# spent 395µs (19+376) within IO::File::new which was called 2 times, avg 198µs/call: # 2 times (19µs+376µs) by Path::Class::File::open at line 70 of Path/Class/File.pm, avg 198µs/call
sub new {
342400ns my $type = shift;
352900ns my $class = ref($type) || $type || "IO::File";
3621µs @_ >= 0 && @_ <= 3
37 or croak "usage: $class->new([FILENAME [,MODE [,PERMS]]])";
3826µs224µs my $fh = $class->SUPER::new();
# spent 24µs making 2 calls to IO::Handle::new, avg 12µs/call
3925µs2352µs if (@_) {
# spent 352µs making 2 calls to IO::File::open, avg 176µs/call
40 $fh->open(@_)
41 or return undef;
42 }
4325µs $fh;
44}
45
46################################################
47## Open
48##
49
50
# spent 352µs (28+324) within IO::File::open which was called 2 times, avg 176µs/call: # 2 times (28µs+324µs) by IO::File::new at line 39, avg 176µs/call
sub open {
5121µs @_ >= 2 && @_ <= 4 or croak 'usage: $fh->open(FILENAME [,MODE [,PERMS]])';
522600ns my ($fh, $file) = @_;
532800ns if (@_ > 2) {
5421µs my ($mode, $perms) = @_[2, 3];
5529µs43µs if ($mode =~ /^\d+$/) {
# spent 3µs making 4 calls to IO::File::CORE:match, avg 800ns/call
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 {
62289µs8535µs return open($fh, IO::Handle::_open_mode_string($mode), $file);
# spent 288µs making 2 calls to IO::File::CORE:open, avg 144µs/call # spent 214µs making 4 calls to Path::Class::File::stringify, avg 54µs/call # spent 33µs making 2 calls to IO::Handle::_open_mode_string, avg 16µs/call
63 }
64 }
65 open($fh, $file);
66}
67
68################################################
69## Binmode
70##
71
72sub 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
8115µs1;
 
# spent 14µs within IO::File::CORE:match which was called 72 times, avg 200ns/call: # 68 times (11µs+0s) by IO::Dir::BEGIN@15 at line 24, avg 165ns/call # 4 times (3µs+0s) by IO::File::open at line 55, avg 800ns/call
sub IO::File::CORE:match; # opcode
# spent 288µs (74+214) within IO::File::CORE:open which was called 2 times, avg 144µs/call: # 2 times (74µs+214µs) by IO::File::open at line 62, avg 144µs/call
sub IO::File::CORE:open; # opcode