← Index
NYTProf Performance Profile   « line view »
For /usr/local/bin/sa-learn
  Run on Sun Nov 5 02:36:06 2017
Reported on Sun Nov 5 02:56:18 2017

Filename/usr/local/lib/perl5/5.24/SelectSaver.pm
StatementsExecuted 56 statements in 889µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
711309µs464µsSelectSaver::::newSelectSaver::new
711109µs127µsSelectSaver::::DESTROYSelectSaver::DESTROY
2131106µs106µsSelectSaver::::CORE:selectSelectSaver::CORE:select (opcode)
11151µs263µsSelectSaver::::BEGIN@38SelectSaver::BEGIN@38
11119µs198µ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
312µsour $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
37118µsrequire 5.000;
38285µs2474µs
# spent 263µs (51+212) within SelectSaver::BEGIN@38 which was called: # once (51µs+212µs) by IO::Handle::BEGIN@268 at line 38
use Carp;
# spent 263µs making 1 call to SelectSaver::BEGIN@38 # spent 212µs making 1 call to Exporter::import
392255µs2376µs
# spent 198µs (19+179) within SelectSaver::BEGIN@39 which was called: # once (19µs+179µs) by IO::Handle::BEGIN@268 at line 39
use Symbol;
# spent 198µs making 1 call to SelectSaver::BEGIN@39 # spent 179µs making 1 call to Exporter::import
40
41
# spent 464µs (309+155) within SelectSaver::new which was called 7 times, avg 66µs/call: # 7 times (309µs+155µs) by IO::Handle::autoflush at line 497 of IO/Handle.pm, avg 66µs/call
sub new {
42731µs @_ >= 1 && @_ <= 2 or croak 'usage: SelectSaver->new( [FILEHANDLE] )';
437117µs742µs my $fh = select;
# spent 42µs making 7 calls to SelectSaver::CORE:select, avg 6µs/call
44729µs my $self = bless \$fh, $_[0];
457154µs14113µs select qualify($_[1], caller) if @_ > 1;
# spent 67µs making 7 calls to Symbol::qualify, avg 10µs/call # spent 46µs making 7 calls to SelectSaver::CORE:select, avg 7µs/call
46752µs $self;
47}
48
49
# spent 127µs (109+18) within SelectSaver::DESTROY which was called 7 times, avg 18µs/call: # 7 times (109µs+18µs) by IO::Handle::autoflush at line 500 of IO/Handle.pm, avg 18µs/call
sub DESTROY {
50715µs my $self = $_[0];
517119µs718µs select $$self;
# spent 18µs making 7 calls to SelectSaver::CORE:select, avg 3µs/call
52}
53
54113µs1;
 
# spent 106µs within SelectSaver::CORE:select which was called 21 times, avg 5µs/call: # 7 times (46µs+0s) by SelectSaver::new at line 45, avg 7µs/call # 7 times (42µs+0s) by SelectSaver::new at line 43, avg 6µs/call # 7 times (18µs+0s) by SelectSaver::DESTROY at line 51, avg 3µs/call
sub SelectSaver::CORE:select; # opcode