Profile of FileHandle.pm

← 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:10 2016

Filename | /usr/share/perl/5.18/FileHandle.pm
Statements | Executed 74 statements in 456µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 14µs | 311µs | FileHandle::::importFileHandle::import
1 | 1 | 1 | 13µs | 13µs | FileHandle::::BEGIN@3FileHandle::BEGIN@3
1 | 1 | 1 | 8µs | 18µs | FileHandle::::BEGIN@46FileHandle::BEGIN@46
1 | 1 | 1 | 7µs | 15µs | FileHandle::::BEGIN@4FileHandle::BEGIN@4
0 | 0 | 0 | 0s | 0s | FileHandle::::pipeFileHandle::pipe

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package FileHandle;
2 |  |  |  |  |
3 | 2 | 40µs | 1 | 13µs | # spent 13µs within FileHandle::BEGIN@3 which was called: # once (13µs+0s) by Stream::Buffered::BEGIN@5 at line 3 use 5.006; # spent 13µs making 1 call to FileHandle::BEGIN@3
4 | 2 | 101µs | 2 | 23µs | # spent 15µs (7+8) within FileHandle::BEGIN@4 which was called: # once (7µs+8µs) by Stream::Buffered::BEGIN@5 at line 4 use strict; # spent 15µs making 1 call to FileHandle::BEGIN@4 # spent 8µs making 1 call to strict::import
5 | 1 | 300ns |  |  | our($VERSION, @ISA, @EXPORT, @EXPORT_OK);
6 |  |  |  |  |
7 | 1 | 400ns |  |  | $VERSION = "2.02";
8 |  |  |  |  |
9 | 1 | 400ns |  |  | require IO::File;
10 | 1 | 8µs |  |  | @ISA = qw(IO::File);
11 |  |  |  |  |
12 | 1 | 600ns |  |  | @EXPORT = qw(_IOFBF _IOLBF _IONBF);
13 |  |  |  |  |
14 | 1 | 3µs |  |  | @EXPORT_OK = qw(
15 |  |  |  |  | pipe
16 |  |  |  |  |
17 |  |  |  |  | autoflush
18 |  |  |  |  | output_field_separator
19 |  |  |  |  | output_record_separator
20 |  |  |  |  | input_record_separator
21 |  |  |  |  | input_line_number
22 |  |  |  |  | format_page_number
23 |  |  |  |  | format_lines_per_page
24 |  |  |  |  | format_lines_left
25 |  |  |  |  | format_name
26 |  |  |  |  | format_top_name
27 |  |  |  |  | format_line_break_characters
28 |  |  |  |  | format_formfeed
29 |  |  |  |  |
30 |  |  |  |  | print
31 |  |  |  |  | printf
32 |  |  |  |  | getline
33 |  |  |  |  | getlines
34 |  |  |  |  | );
35 |  |  |  |  |
36 |  |  |  |  | #
37 |  |  |  |  | # Everything we're willing to export, we must first import.
38 |  |  |  |  | #
39 | 1 | 19µs | 1 | 123µs | import IO::Handle grep { !defined(&$_) } @EXPORT, @EXPORT_OK; # spent 123µs making 1 call to Exporter::import
40 |  |  |  |  |
41 |  |  |  |  | #
42 |  |  |  |  | # Some people call "FileHandle::function", so all the functions
43 |  |  |  |  | # that were in the old FileHandle class must be imported, too.
44 |  |  |  |  | #
45 |  |  |  |  | {
46 | 3 | 211µs | 2 | 27µs | # spent 18µs (8+10) within FileHandle::BEGIN@46 which was called: # once (8µs+10µs) by Stream::Buffered::BEGIN@5 at line 46 no strict 'refs'; # spent 18µs making 1 call to FileHandle::BEGIN@46 # spent 10µs making 1 call to strict::unimport
47 |  |  |  |  |
48 | 1 | 6µs |  |  | my %import = (
49 |  |  |  |  | 'IO::Handle' =>
50 |  |  |  |  | [qw(DESTROY new_from_fd fdopen close fileno getc ungetc gets
51 |  |  |  |  | eof flush error clearerr setbuf setvbuf _open_mode_string)],
52 |  |  |  |  | 'IO::Seekable' =>
53 |  |  |  |  | [qw(seek tell getpos setpos)],
54 |  |  |  |  | 'IO::File' =>
55 |  |  |  |  | [qw(new new_tmpfile open)]
56 |  |  |  |  | );
57 | 1 | 3µs |  |  | for my $pkg (keys %import) {
58 | 3 | 2µs |  |  | for my $func (@{$import{$pkg}}) {
59 | 22 | 21µs |  |  | my $c = *{"${pkg}::$func"}{CODE}
60 |  |  |  |  | or die "${pkg}::$func missing";
61 | 22 | 22µs |  |  | *$func = $c;
62 |  |  |  |  | }
63 |  |  |  |  | }
64 |  |  |  |  | }
65 |  |  |  |  |
66 |  |  |  |  | #
67 |  |  |  |  | # Specialized importer for Fcntl magic.
68 |  |  |  |  | #
69 |  |  |  |  | # spent 311µs (14+297) within FileHandle::import which was called: # once (14µs+297µs) by Stream::Buffered::BEGIN@5 at line 5 of Stream/Buffered.pm sub import {
70 | 1 | 300ns |  |  | my $pkg = shift;
71 | 1 | 300ns |  |  | my $callpkg = caller;
72 | 1 | 400ns |  |  | require Exporter;
73 | 1 | 1µs | 1 | 20µs | Exporter::export($pkg, $callpkg, @_); # spent 20µs making 1 call to Exporter::export
74 |  |  |  |  |
75 |  |  |  |  | #
76 |  |  |  |  | # If the Fcntl extension is available,
77 |  |  |  |  | # export its constants.
78 |  |  |  |  | #
79 | 1 | 3µs |  |  | eval {
80 | 1 | 400ns |  |  | require Fcntl;
81 | 1 | 1µs | 1 | 9µs | Exporter::export('Fcntl', $callpkg); # spent 9µs making 1 call to Exporter::export
82 |  |  |  |  | };
83 |  |  |  |  | }
84 |  |  |  |  |
85 |  |  |  |  | ################################################
86 |  |  |  |  | # This is the only exported function we define;
87 |  |  |  |  | # the rest come from other classes.
88 |  |  |  |  | #
89 |  |  |  |  |
90 |  |  |  |  | sub pipe {
91 |  |  |  |  | my $r = new IO::Handle;
92 |  |  |  |  | my $w = new IO::Handle;
93 |  |  |  |  | CORE::pipe($r, $w) or return undef;
94 |  |  |  |  | ($r, $w);
95 |  |  |  |  | }
96 |  |  |  |  |
97 |  |  |  |  | # Rebless standard file handles
98 | 1 | 700ns |  |  | bless *STDIN{IO}, "FileHandle" if ref *STDIN{IO} eq "IO::Handle";
99 | 1 | 300ns |  |  | bless *STDOUT{IO}, "FileHandle" if ref *STDOUT{IO} eq "IO::Handle";
100 | 1 | 200ns |  |  | bless *STDERR{IO}, "FileHandle" if ref *STDERR{IO} eq "IO::Handle";
101 |  |  |  |  |
102 | 1 | 10µs |  |  | 1;
103 |  |  |  |  |
104 |  |  |  |  | __END__