← 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:56 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
63243µs43µsSelectSaver::::CORE:selectSelectSaver::CORE:select (opcode)
21142µs88µsSelectSaver::::newSelectSaver::new
11114µs45µsSelectSaver::::BEGIN@38SelectSaver::BEGIN@38
21112µs13µsSelectSaver::::DESTROYSelectSaver::DESTROY
1118µs38µsSelectSaver::::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
1package SelectSaver;
2
31600nsour $VERSION = '1.02';
4
5=head1 NAME
6
7SelectSaver - 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
27A C<SelectSaver> object contains a reference to the file handle that
28was selected when it was created. If its C<new> method gets an extra
29parameter, then that parameter is selected; otherwise, the selected
30file handle remains unchanged.
31
32When a C<SelectSaver> is destroyed, it re-selects the file handle
33that was selected when it was created.
34
35=cut
36
37113µsrequire 5.000;
38323µs277µ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
393100µs268µ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 {
4224µs @_ >= 1 && @_ <= 2 or croak 'usage: SelectSaver->new( [FILEHANDLE] )';
43215µs24µs my $fh = select;
# spent 4µs making 2 calls to SelectSaver::CORE:select, avg 2µs/call
4429µs my $self = bless \$fh, $_[0];
45249µs443µs 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
4627µs $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 {
502600ns my $self = $_[0];
51214µs2700ns select $$self;
# spent 700ns making 2 calls to SelectSaver::CORE:select, avg 350ns/call
52}
53
5414µs1;
# 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