Profile of /usr/local/lib/perl5/5.10.1/SelectSaver.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For 05.Domain_and_Item.t
Run on Tue May 4 17:21:41 2010
Reported on Tue May 4 17:22:25 2010

File | /usr/local/lib/perl5/5.10.1/SelectSaver.pm
Statements Executed | 23
Statement Execution Time | 238µs

Subroutines — ordered by exclusive time
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
6 | 3 | 2 | 43µs | 43µs | SelectSaver::::CORE:selectSelectSaver::CORE:select (opcode)
2 | 1 | 1 | 42µs | 88µs | SelectSaver::::newSelectSaver::new
1 | 1 | 1 | 14µs | 45µs | SelectSaver::::BEGIN@38SelectSaver::BEGIN@38
2 | 1 | 1 | 12µs | 13µs | SelectSaver::::DESTROYSelectSaver::DESTROY
1 | 1 | 1 | 8µs | 38µs | SelectSaver::::BEGIN@39SelectSaver::BEGIN@39

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

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package SelectSaver;
2 |  |  |  |  |
3 | 1 | 600ns |  |  | our $VERSION = '1.02';
4 |  |  |  |  |
5 |  |  |  |  | =head1 NAME
6 |  |  |  |  |
7 |  |  |  |  | SelectSaver - save and restore selected file handle
8 |  |  |  |  |
9 |  |  |  |  | =head1 SYNOPSIS
10 |  |  |  |  |
11 |  |  |  |  | use SelectSaver;
12 |  |  |  |  |
13 |  |  |  |  | {
14 |  |  |  |  | my $saver = SelectSaver->new(FILEHANDLE);
15 |  |  |  |  | # FILEHANDLE is selected
16 |  |  |  |  | }
17 |  |  |  |  | # previous handle is selected
18 |  |  |  |  |
19 |  |  |  |  | {
20 |  |  |  |  | my $saver = SelectSaver->new;
21 |  |  |  |  | # new handle may be selected, or not
22 |  |  |  |  | }
23 |  |  |  |  | # previous handle is selected
24 |  |  |  |  |
25 |  |  |  |  | =head1 DESCRIPTION
26 |  |  |  |  |
27 |  |  |  |  | A C<SelectSaver> object contains a reference to the file handle that
28 |  |  |  |  | was selected when it was created. If its C<new> method gets an extra
29 |  |  |  |  | parameter, then that parameter is selected; otherwise, the selected
30 |  |  |  |  | file handle remains unchanged.
31 |  |  |  |  |
32 |  |  |  |  | When a C<SelectSaver> is destroyed, it re-selects the file handle
33 |  |  |  |  | that was selected when it was created.
34 |  |  |  |  |
35 |  |  |  |  | =cut
36 |  |  |  |  |
37 | 1 | 13µs |  |  | require 5.000;
38 | 3 | 23µs | 2 | 77µs | # spent 45µs (14+32) within SelectSaver::BEGIN@38 which was called # once (14µs+32µs) by IO::File::BEGIN@132 at line 38 use Carp; # spent 45µs making 1 call to SelectSaver::BEGIN@38 # spent 32µs making 1 call to Exporter::import
39 | 3 | 100µs | 2 | 68µs | # spent 38µs (8+30) within SelectSaver::BEGIN@39 which was called # once (8µs+30µs) by IO::File::BEGIN@132 at line 39 use Symbol; # spent 38µs making 1 call to SelectSaver::BEGIN@39 # spent 30µs making 1 call to Exporter::import
40 |  |  |  |  |
41 |  |  |  |  | # spent 88µs (42+46) within SelectSaver::new which was called 2 times, avg 44µs/call: # 2 times (42µs+46µs) by IO::Handle::autoflush at line 479 of IO/Handle.pm, avg 44µs/call sub new {
42 | 10 | 83µs |  |  | @_ >= 1 && @_ <= 2 or croak 'usage: SelectSaver->new( [FILEHANDLE] )';
43 |  |  |  |  | my $fh = select; # spent 4µs making 2 calls to SelectSaver::CORE:select, avg 2µs/call
44 |  |  |  |  | my $self = bless \$fh, $_[0];
45 |  |  |  |  | select qualify($_[1], caller) if @_ > 1; # spent 39µs making 2 calls to SelectSaver::CORE:select, avg 19µs/call # spent 4µs making 2 calls to Symbol::qualify, avg 2µs/call
46 |  |  |  |  | $self;
47 |  |  |  |  | }
48 |  |  |  |  |
49 |  |  |  |  | # spent 13µs (12+700ns) within SelectSaver::DESTROY which was called 2 times, avg 6µs/call: # 2 times (12µs+700ns) by IO::Handle::autoflush at line 44 of IO/Socket.pm, avg 6µs/call sub DESTROY {
50 | 4 | 15µs |  |  | my $self = $_[0];
51 |  |  |  |  | select $$self; # spent 700ns making 2 calls to SelectSaver::CORE:select, avg 350ns/call
52 |  |  |  |  | }
53 |  |  |  |  |
54 | 1 | 4µs |  |  | 1;
|  |  |  |  | # spent 43µs within SelectSaver::CORE:select which was called 6 times, avg 7µs/call: # 2 times (39µs+0s) by SelectSaver::new at line 45 of SelectSaver.pm, avg 19µs/call # 2 times (4µs+0s) by SelectSaver::new at line 43 of SelectSaver.pm, avg 2µs/call # 2 times (700ns+0s) by SelectSaver::DESTROY at line 51 of SelectSaver.pm, avg 350ns/call sub SelectSaver::CORE:select; # xsub