← Index
NYTProf Performance Profile   « line view »
For split.pl
  Run on Thu Apr 20 02:05:47 2023
Reported on Thu Apr 20 18:31:10 2023

Filename/home/hejohns/perl5/lib/perl5/Data/Printer/Filter/GLOB.pm
StatementsExecuted 16 statements in 316µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1118µs10µsData::Printer::Filter::GLOB::::BEGIN@2Data::Printer::Filter::GLOB::BEGIN@2
1116µs142µsData::Printer::Filter::GLOB::::BEGIN@7Data::Printer::Filter::GLOB::BEGIN@7
1116µs6µsData::Printer::Filter::GLOB::::BEGIN@5Data::Printer::Filter::GLOB::BEGIN@5
1115µs19µsData::Printer::Filter::GLOB::::BEGIN@22Data::Printer::Filter::GLOB::BEGIN@22
1114µs18µsData::Printer::Filter::GLOB::::BEGIN@3Data::Printer::Filter::GLOB::BEGIN@3
1114µs16µsData::Printer::Filter::GLOB::::BEGIN@4Data::Printer::Filter::GLOB::BEGIN@4
1112µs2µsData::Printer::Filter::GLOB::::BEGIN@6Data::Printer::Filter::GLOB::BEGIN@6
111300ns300nsData::Printer::Filter::GLOB::::__ANON__Data::Printer::Filter::GLOB::__ANON__ (xsub)
0000s0sData::Printer::Filter::GLOB::::__ANON__[:49]Data::Printer::Filter::GLOB::__ANON__[:49]
0000s0sData::Printer::Filter::GLOB::::parseData::Printer::Filter::GLOB::parse
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Data::Printer::Filter::GLOB;
2217µs212µs
# spent 10µs (8+2) within Data::Printer::Filter::GLOB::BEGIN@2 which was called: # once (8µs+2µs) by Data::Printer::Object::BEGIN@57 at line 2
use strict;
# spent 10µs making 1 call to Data::Printer::Filter::GLOB::BEGIN@2 # spent 2µs making 1 call to strict::import
3212µs233µs
# spent 18µs (4+14) within Data::Printer::Filter::GLOB::BEGIN@3 which was called: # once (4µs+14µs) by Data::Printer::Object::BEGIN@57 at line 3
use warnings;
# spent 18µs making 1 call to Data::Printer::Filter::GLOB::BEGIN@3 # spent 14µs making 1 call to warnings::import
4215µs229µs
# spent 16µs (4+12) within Data::Printer::Filter::GLOB::BEGIN@4 which was called: # once (4µs+12µs) by Data::Printer::Object::BEGIN@57 at line 4
use Data::Printer::Filter;
# spent 16µs making 1 call to Data::Printer::Filter::GLOB::BEGIN@4 # spent 12µs making 1 call to Data::Printer::Filter::import
5215µs26µs
# spent 6µs (6+300ns) within Data::Printer::Filter::GLOB::BEGIN@5 which was called: # once (6µs+300ns) by Data::Printer::Object::BEGIN@57 at line 5
use Data::Printer::Common;
# spent 6µs making 1 call to Data::Printer::Filter::GLOB::BEGIN@5 # spent 300ns making 1 call to Data::Printer::Filter::GLOB::__ANON__
6215µs12µs
# spent 2µs within Data::Printer::Filter::GLOB::BEGIN@6 which was called: # once (2µs+0s) by Data::Printer::Object::BEGIN@57 at line 6
use Scalar::Util ();
# spent 2µs making 1 call to Data::Printer::Filter::GLOB::BEGIN@6
7256µs2278µs
# spent 142µs (6+136) within Data::Printer::Filter::GLOB::BEGIN@7 which was called: # once (6µs+136µs) by Data::Printer::Object::BEGIN@57 at line 7
use Fcntl;
# spent 142µs making 1 call to Data::Printer::Filter::GLOB::BEGIN@7 # spent 136µs making 1 call to Exporter::import
8
912µs116µsfilter 'GLOB' => \&parse;
10
11
12sub parse {
13 my ($glob, $ddp) = @_;
14
15 my $string = $ddp->maybe_colorize("$$glob", 'glob');
16
17 # unfortunately, some systems (like Win32) do not
18 # implement some of these flags (maybe not even
19 # fcntl() itself, so we must wrap it.
20 my $extra = '';
21 my $flags;
222182µs234µs
# spent 19µs (5+15) within Data::Printer::Filter::GLOB::BEGIN@22 which was called: # once (5µs+15µs) by Data::Printer::Object::BEGIN@57 at line 22
eval { no warnings qw( unopened closed ); $flags = fcntl($$glob, F_GETFL, 0) };
# spent 19µs making 1 call to Data::Printer::Filter::GLOB::BEGIN@22 # spent 14µs making 1 call to warnings::unimport
23 if ($flags) {
24 $extra .= ($flags & O_WRONLY) ? 'write-only'
25 : ($flags & O_RDWR) ? 'read/write'
26 : 'read-only'
27 ;
28
29 # How to avoid croaking when the system
30 # doesn't implement one of those, without skipping
31 # the whole thing? Maybe there's a better way.
32 # Solaris, for example, doesn't have O_ASYNC :(
33 my %flags = ();
34 eval { $flags{'append'} = O_APPEND };
35 eval { $flags{'async'} = O_ASYNC }; # leont says this is the only one I should care for.
36 eval { $flags{'create'} = O_CREAT };
37 eval { $flags{'truncate'} = O_TRUNC };
38 eval { $flags{'nonblocking'} = O_NONBLOCK };
39
40 if (my @flags = grep { $flags & $flags{$_} } sort keys %flags) {
41 $extra .= ", flags: @flags";
42 }
43 $extra .= ', ';
44 }
45 my @layers = ();
46 # TODO: try PerlIO::Layers::get_layers (leont)
47 my $error = Data::Printer::Common::_tryme(sub {
48 @layers = PerlIO::get_layers $$glob
49 });
50 $extra .= "layers: @layers" unless $error;
51 $string .= " ($extra)" if $extra;
52
53 if ($ddp->show_tied and my $tie = ref tied *$$glob) {
54 $string .= " (tied to $tie)"
55 }
56 return $string;
57};
58
5912µs1;
 
# spent 300ns within Data::Printer::Filter::GLOB::__ANON__ which was called: # once (300ns+0s) by Data::Printer::Filter::GLOB::BEGIN@5 at line 5
sub Data::Printer::Filter::GLOB::__ANON__; # xsub