← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Thu Dec 15 15:23:56 2022
Reported on Thu Dec 15 15:27:04 2022

Filename/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/YAML/PP/Writer/File.pm
StatementsExecuted 12 statements in 321µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11124µs26µsYAML::PP::Dumper::::BEGIN@1.298 YAML::PP::Dumper::BEGIN@1.298
11110µs35µsYAML::PP::Writer::File::::BEGIN@11YAML::PP::Writer::File::BEGIN@11
1116µs57µsYAML::PP::Writer::File::::BEGIN@9YAML::PP::Writer::File::BEGIN@9
1115µs50µsYAML::PP::Dumper::::BEGIN@2.299 YAML::PP::Dumper::BEGIN@2.299
1115µs30µsYAML::PP::Writer::File::::BEGIN@7YAML::PP::Writer::File::BEGIN@7
0000s0sYAML::PP::Writer::File::::_open_handleYAML::PP::Writer::File::_open_handle
0000s0sYAML::PP::Writer::File::::finishYAML::PP::Writer::File::finish
0000s0sYAML::PP::Writer::File::::initYAML::PP::Writer::File::init
0000s0sYAML::PP::Writer::File::::writeYAML::PP::Writer::File::write
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1222µs228µs
# spent 26µs (24+2) within YAML::PP::Dumper::BEGIN@1.298 which was called: # once (24µs+2µs) by YAML::PP::Dumper::BEGIN@12 at line 1
use strict;
# spent 26µs making 1 call to YAML::PP::Dumper::BEGIN@1.298 # spent 2µs making 1 call to strict::import
2238µs295µs
# spent 50µs (5+45) within YAML::PP::Dumper::BEGIN@2.299 which was called: # once (5µs+45µs) by YAML::PP::Dumper::BEGIN@12 at line 2
use warnings;
# spent 50µs making 1 call to YAML::PP::Dumper::BEGIN@2.299 # spent 45µs making 1 call to warnings::import
3package YAML::PP::Writer::File;
4
510sour $VERSION = '0.035'; # VERSION
6
7218µs255µs
# spent 30µs (5+25) within YAML::PP::Writer::File::BEGIN@7 which was called: # once (5µs+25µs) by YAML::PP::Dumper::BEGIN@12 at line 7
use Scalar::Util qw/ openhandle /;
# spent 30µs making 1 call to YAML::PP::Writer::File::BEGIN@7 # spent 25µs making 1 call to Exporter::import
8
9241µs2108µs
# spent 57µs (6+51) within YAML::PP::Writer::File::BEGIN@9 which was called: # once (6µs+51µs) by YAML::PP::Dumper::BEGIN@12 at line 9
use base qw/ YAML::PP::Writer /;
# spent 57µs making 1 call to YAML::PP::Writer::File::BEGIN@9 # spent 51µs making 1 call to base::import
10
112199µs260µs
# spent 35µs (10+25) within YAML::PP::Writer::File::BEGIN@11 which was called: # once (10µs+25µs) by YAML::PP::Dumper::BEGIN@12 at line 11
use Carp qw/ croak /;
# spent 35µs making 1 call to YAML::PP::Writer::File::BEGIN@11 # spent 25µs making 1 call to Exporter::import
12
13sub _open_handle {
14 my ($self) = @_;
15 if (openhandle($self->{output})) {
16 $self->{filehandle} = $self->{output};
17 return $self->{output};
18 }
19 open my $fh, '>:encoding(UTF-8)', $self->{output}
20 or croak "Could not open '$self->{output}' for writing: $!";
21 $self->{filehandle} = $fh;
22 return $fh;
23}
24
25sub write {
26 my ($self, $line) = @_;
27 my $fh = $self->{filehandle};
28 print $fh $line;
29}
30
31sub init {
32 my ($self) = @_;
33 my $fh = $self->_open_handle;
34}
35
36sub finish {
37 my ($self) = @_;
38 if (openhandle($self->{output})) {
39 # Original argument was a file handle, so the caller needs
40 # to close it
41 return;
42 }
43 close $self->{filehandle};
44}
45
4613µs1;
47
48__END__