← Index
Performance Profile   « block view • line view • sub view »
For t/test-parsing
  Run on Sun Nov 14 09:49:57 2010
Reported on Sun Nov 14 09:50:06 2010

File /usr/share/perl/5.10/FileHandle.pm
Statements Executed 77
Total Time 0.0008676 seconds
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111436µs486µsFileHandle::::importFileHandle::import
0000s0sFileHandle::::BEGINFileHandle::BEGIN
0000s0sFileHandle::::pipeFileHandle::pipe
LineStmts.Exclusive
Time
Avg.Code
1package FileHandle;
2
3339µs13µsuse 5.006;
43163µs54µsuse strict;
# spent 8µs making 1 call to strict::import
51600ns600nsour($VERSION, @ISA, @EXPORT, @EXPORT_OK);
6
71700ns700ns$VERSION = "2.01";
8
9192µs92µsrequire IO::File;
1019µs9µs@ISA = qw(IO::File);
11
1211µs1µs@EXPORT = qw(_IOFBF _IOLBF _IONBF);
13
1414µs4µ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#
39128µs28µsimport IO::Handle grep { !defined(&$_) } @EXPORT, @EXPORT_OK;
# spent 160µ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{
464335µs84µs no strict 'refs';
# spent 28µs making 1 call to strict::unimport
47
4819µs9µ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 );
5719µs9µs for my $pkg (keys %import) {
5835µs2µs for my $func (@{$import{$pkg}}) {
592239µs2µs my $c = *{"${pkg}::$func"}{CODE}
60 or die "${pkg}::$func missing";
612260µs3µs *$func = $c;
62 }
63 }
64}
65
66#
67# Specialized importer for Fcntl magic.
68#
69
# spent 486µs (436+50) within FileHandle::import which was called # once (436µs+50µs) at line 23 of /usr/local/lib/perl/5.10.0/Storable.pm
sub import {
70728µs4µs my $pkg = shift;
71 my $callpkg = caller;
72 require Exporter;
73 Exporter::export($pkg, $callpkg, @_);
# spent 25µs making 1 call to Exporter::export
74
75 #
76 # If the Fcntl extension is available,
77 # export its constants.
78 #
79 eval {
80 require Fcntl;
81 Exporter::export('Fcntl', $callpkg);
# spent 25µ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
90sub 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
9817µs7µsbless *STDIN{IO}, "FileHandle" if ref *STDIN{IO} eq "IO::Handle";
9912µs2µsbless *STDOUT{IO}, "FileHandle" if ref *STDOUT{IO} eq "IO::Handle";
10011µs1µsbless *STDERR{IO}, "FileHandle" if ref *STDERR{IO} eq "IO::Handle";
101
102133µs33µs1;
103
104__END__
105