← Index
NYTProf Performance Profile   « line view »
For bin/benchmark-perlformance
  Run on Fri Apr 17 15:31:48 2015
Reported on Fri Apr 17 15:32:03 2015

Filename/home/ss5/perl5/perlbrew/perls/tapper-perl/lib/5.16.3/SelectSaver.pm
StatementsExecuted 14 statements in 142µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11124µs31µsSelectSaver::::newSelectSaver::new
11110µs36µsSelectSaver::::BEGIN@38SelectSaver::BEGIN@38
1117µs9µsSelectSaver::::DESTROYSelectSaver::DESTROY
1117µs30µsSelectSaver::::BEGIN@39SelectSaver::BEGIN@39
3315µs5µsSelectSaver::::CORE:selectSelectSaver::CORE:select (opcode)
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
31400nsour $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
3717µsrequire 5.000;
38218µs262µs
# spent 36µs (10+26) within SelectSaver::BEGIN@38 which was called: # once (10µs+26µs) by IO::Handle::BEGIN@265 at line 38
use Carp;
# spent 36µs making 1 call to SelectSaver::BEGIN@38 # spent 26µs making 1 call to Exporter::import
39277µs253µs
# spent 30µs (7+23) within SelectSaver::BEGIN@39 which was called: # once (7µs+23µs) by IO::Handle::BEGIN@265 at line 39
use Symbol;
# spent 30µs making 1 call to SelectSaver::BEGIN@39 # spent 23µs making 1 call to Exporter::import
40
41
# spent 31µs (24+6) within SelectSaver::new which was called: # once (24µs+6µs) by IO::Handle::autoflush at line 494 of IO/Handle.pm
sub new {
4211µs @_ >= 1 && @_ <= 2 or croak 'usage: SelectSaver->new( [FILEHANDLE] )';
43110µs12µs my $fh = select;
# spent 2µs making 1 call to SelectSaver::CORE:select
4414µs my $self = bless \$fh, $_[0];
4518µs24µs select qualify($_[1], caller) if @_ > 1;
# spent 2µs making 1 call to Symbol::qualify # spent 1µs making 1 call to SelectSaver::CORE:select
4614µs $self;
47}
48
49
# spent 9µs (7+2) within SelectSaver::DESTROY which was called: # once (7µs+2µs) by IO::Handle::autoflush at line 267 of lib/Benchmark/Perl/Formance.pm
sub DESTROY {
501400ns my $self = $_[0];
51111µs12µs select $$self;
# spent 2µs making 1 call to SelectSaver::CORE:select
52}
53
5412µs1;
 
# spent 5µs within SelectSaver::CORE:select which was called 3 times, avg 2µs/call: # once (2µs+0s) by SelectSaver::new at line 43 # once (2µs+0s) by SelectSaver::DESTROY at line 51 # once (1µs+0s) by SelectSaver::new at line 45
sub SelectSaver::CORE:select; # opcode