← Index
NYTProf Performance Profile   « line view »
For /usr/local/bin/sa-learn
  Run on Tue Nov 7 05:38:10 2017
Reported on Tue Nov 7 06:16:01 2017

Filename/usr/local/lib/perl5/5.24/SelectSaver.pm
StatementsExecuted 70 statements in 1.05ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
911447µs660µsSelectSaver::::newSelectSaver::new
911139µs165µsSelectSaver::::DESTROYSelectSaver::DESTROY
2731136µs136µsSelectSaver::::CORE:selectSelectSaver::CORE:select (opcode)
11144µs276µsSelectSaver::::BEGIN@38SelectSaver::BEGIN@38
11123µs199µ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
37132µsrequire 5.000;
38281µs2507µs
# spent 276µs (44+232) within SelectSaver::BEGIN@38 which was called: # once (44µs+232µs) by IO::Handle::BEGIN@268 at line 38
use Carp;
# spent 276µs making 1 call to SelectSaver::BEGIN@38 # spent 232µs making 1 call to Exporter::import
392240µs2376µs
# spent 199µs (23+177) within SelectSaver::BEGIN@39 which was called: # once (23µs+177µs) by IO::Handle::BEGIN@268 at line 39
use Symbol;
# spent 199µs making 1 call to SelectSaver::BEGIN@39 # spent 177µs making 1 call to Exporter::import
40
41
# spent 660µs (447+213) within SelectSaver::new which was called 9 times, avg 73µs/call: # 9 times (447µs+213µs) by IO::Handle::autoflush at line 497 of IO/Handle.pm, avg 73µs/call
sub new {
42948µs @_ >= 1 && @_ <= 2 or croak 'usage: SelectSaver->new( [FILEHANDLE] )';
439158µs957µs my $fh = select;
# spent 57µs making 9 calls to SelectSaver::CORE:select, avg 6µs/call
44938µs my $self = bless \$fh, $_[0];
459197µs18156µs select qualify($_[1], caller) if @_ > 1;
# spent 103µs making 9 calls to Symbol::qualify, avg 11µs/call # spent 53µs making 9 calls to SelectSaver::CORE:select, avg 6µs/call
46968µs $self;
47}
48
49
# spent 165µs (139+26) within SelectSaver::DESTROY which was called 9 times, avg 18µs/call: # 9 times (139µs+26µs) by IO::Handle::autoflush at line 500 of IO/Handle.pm, avg 18µs/call
sub DESTROY {
50919µs my $self = $_[0];
519158µs926µs select $$self;
# spent 26µs making 9 calls to SelectSaver::CORE:select, avg 3µs/call
52}
53
5417µs1;
 
# spent 136µs within SelectSaver::CORE:select which was called 27 times, avg 5µs/call: # 9 times (57µs+0s) by SelectSaver::new at line 43, avg 6µs/call # 9 times (53µs+0s) by SelectSaver::new at line 45, avg 6µs/call # 9 times (26µs+0s) by SelectSaver::DESTROY at line 51, avg 3µs/call
sub SelectSaver::CORE:select; # opcode