← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:07 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0/SelectSaver.pm
StatementsExecuted 14021 statements in 53.9ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
20021129.9ms40.3msSelectSaver::::newSelectSaver::new
6006319.19ms9.19msSelectSaver::::CORE:selectSelectSaver::CORE:select (opcode)
2002117.66ms8.04msSelectSaver::::DESTROYSelectSaver::DESTROY
1117µs26µsSelectSaver::::BEGIN@38SelectSaver::BEGIN@38
1114µs19µ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
31200nsour $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
3715µsrequire 5.000;
38214µs245µs
# spent 26µs (7+19) within SelectSaver::BEGIN@38 which was called: # once (7µs+19µs) by IO::Handle::BEGIN@268 at line 38
use Carp;
# spent 26µs making 1 call to SelectSaver::BEGIN@38 # spent 19µs making 1 call to Exporter::import
39261µs234µs
# spent 19µs (4+15) within SelectSaver::BEGIN@39 which was called: # once (4µs+15µs) by IO::Handle::BEGIN@268 at line 39
use Symbol;
# spent 19µs making 1 call to SelectSaver::BEGIN@39 # spent 15µs making 1 call to Exporter::import
40
41
# spent 40.3ms (29.9+10.4) within SelectSaver::new which was called 2002 times, avg 20µs/call: # 2002 times (29.9ms+10.4ms) by IO::Handle::autoflush at line 497 of IO/Handle.pm, avg 20µs/call
sub new {
4220022.18ms @_ >= 1 && @_ <= 2 or croak 'usage: SelectSaver->new( [FILEHANDLE] )';
4320026.74ms20022.50ms my $fh = select;
# spent 2.50ms making 2002 calls to SelectSaver::CORE:select, avg 1µs/call
4420021.55ms my $self = bless \$fh, $_[0];
45200218.7ms40047.91ms select qualify($_[1], caller) if @_ > 1;
# spent 6.32ms making 2002 calls to SelectSaver::CORE:select, avg 3µs/call # spent 1.59ms making 2002 calls to Symbol::qualify, avg 794ns/call
4620029.60ms $self;
47}
48
49
# spent 8.04ms (7.66+373µs) within SelectSaver::DESTROY which was called 2002 times, avg 4µs/call: # 2002 times (7.66ms+373µs) by IO::Handle::autoflush at line 45 of IO/Socket.pm, avg 4µs/call
sub DESTROY {
502002576µs my $self = $_[0];
51200214.4ms2002373µs select $$self;
# spent 373µs making 2002 calls to SelectSaver::CORE:select, avg 186ns/call
52}
53
5412µs1;
 
# spent 9.19ms within SelectSaver::CORE:select which was called 6006 times, avg 2µs/call: # 2002 times (6.32ms+0s) by SelectSaver::new at line 45, avg 3µs/call # 2002 times (2.50ms+0s) by SelectSaver::new at line 43, avg 1µs/call # 2002 times (373µs+0s) by SelectSaver::DESTROY at line 51, avg 186ns/call
sub SelectSaver::CORE:select; # opcode