← Index
NYTProf Performance Profile   « line view »
For /usr/local/bin/sa-learn
  Run on Sun Nov 5 03:09:29 2017
Reported on Mon Nov 6 13:20:46 2017

Filename/usr/local/lib/perl5/5.24/SelectSaver.pm
StatementsExecuted 22554 statements in 264ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
322111171ms237msSelectSaver::::newSelectSaver::new
32211151.7ms60.1msSelectSaver::::DESTROYSelectSaver::DESTROY
96633137.1ms37.1msSelectSaver::::CORE:selectSelectSaver::CORE:select (opcode)
11134µs169µsSelectSaver::::BEGIN@38SelectSaver::BEGIN@38
11119µs150µ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
37114µsrequire 5.000;
38252µs2305µs
# spent 169µs (34+135) within SelectSaver::BEGIN@38 which was called: # once (34µs+135µs) by IO::Handle::BEGIN@268 at line 38
use Carp;
# spent 169µs making 1 call to SelectSaver::BEGIN@38 # spent 135µs making 1 call to Exporter::import
392217µs2281µs
# spent 150µs (19+131) within SelectSaver::BEGIN@39 which was called: # once (19µs+131µs) by IO::Handle::BEGIN@268 at line 39
use Symbol;
# spent 150µs making 1 call to SelectSaver::BEGIN@39 # spent 131µs making 1 call to Exporter::import
40
41
# spent 237ms (171+66.3) within SelectSaver::new which was called 3221 times, avg 74µs/call: # 3221 times (171ms+66.3ms) by IO::Handle::autoflush at line 497 of IO/Handle.pm, avg 74µs/call
sub new {
42322113.5ms @_ >= 1 && @_ <= 2 or croak 'usage: SelectSaver->new( [FILEHANDLE] )';
43322159.3ms322119.8ms my $fh = select;
# spent 19.8ms making 3221 calls to SelectSaver::CORE:select, avg 6µs/call
44322112.6ms my $self = bless \$fh, $_[0];
45322182.8ms644246.5ms select qualify($_[1], caller) if @_ > 1;
# spent 37.6ms making 3221 calls to Symbol::qualify, avg 12µs/call # spent 8.84ms making 3221 calls to SelectSaver::CORE:select, avg 3µs/call
46322131.3ms $self;
47}
48
49
# spent 60.1ms (51.7+8.44) within SelectSaver::DESTROY which was called 3221 times, avg 19µs/call: # 3221 times (51.7ms+8.44ms) by IO::Handle::autoflush at line 500 of IO/Handle.pm, avg 19µs/call
sub DESTROY {
5032216.73ms my $self = $_[0];
51322158.0ms32218.44ms select $$self;
# spent 8.44ms making 3221 calls to SelectSaver::CORE:select, avg 3µs/call
52}
53
5417µs1;
 
# spent 37.1ms within SelectSaver::CORE:select which was called 9663 times, avg 4µs/call: # 3221 times (19.8ms+0s) by SelectSaver::new at line 43, avg 6µs/call # 3221 times (8.84ms+0s) by SelectSaver::new at line 45, avg 3µs/call # 3221 times (8.44ms+0s) by SelectSaver::DESTROY at line 51, avg 3µs/call
sub SelectSaver::CORE:select; # opcode