Filename | /usr/lib/x86_64-linux-gnu/perl5/5.28/YAML/XS.pm |
Statements | Executed 1028 statements in 14.4ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
144 | 1 | 1 | 2.03ms | 12.7ms | LoadFile | YAML::XS::
1 | 1 | 1 | 1.32ms | 1.41ms | BEGIN@6 | YAML::XS::
144 | 1 | 1 | 905µs | 905µs | CORE:open (opcode) | YAML::XS::
1 | 1 | 1 | 872µs | 1.18ms | BEGIN@21 | YAML::XS::
144 | 1 | 1 | 859µs | 859µs | CORE:readline (opcode) | YAML::XS::
1 | 1 | 1 | 268µs | 634µs | BEGIN@20 | YAML::XS::
1 | 1 | 1 | 26µs | 79µs | BEGIN@99 | YAML::XS::
1 | 1 | 1 | 9µs | 11µs | BEGIN@1.2 | RBM::
1 | 1 | 1 | 5µs | 18µs | BEGIN@1.3 | RBM::
0 | 0 | 0 | 0s | 0s | DumpFile | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:100] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:101] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:102] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:103] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:104] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:105] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:106] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:107] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:108] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:109] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:110] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:111] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:112] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:113] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:114] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:115] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:135] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:73] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __ANON__[:97] | YAML::XS::
0 | 0 | 0 | 0s | 0s | __code_loader | YAML::XS::
0 | 0 | 0 | 0s | 0s | __qr_loader | YAML::XS::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 4 | 52µs | 4 | 43µs | use strict; use warnings; # spent 18µs making 1 call to RBM::BEGIN@1.3
# spent 13µs making 1 call to warnings::import
# spent 11µs making 1 call to RBM::BEGIN@1.2
# spent 2µs making 1 call to strict::import |
2 | |||||
3 | package YAML::XS; | ||||
4 | 1 | 300ns | our $VERSION = '0.76'; | ||
5 | |||||
6 | 2 | 137µs | 2 | 1.47ms | # spent 1.41ms (1.32+90µs) within YAML::XS::BEGIN@6 which was called:
# once (1.32ms+90µs) by RBM::BEGIN@8 at line 6 # spent 1.41ms making 1 call to YAML::XS::BEGIN@6
# spent 60µs making 1 call to base::import |
7 | |||||
8 | 1 | 1µs | @YAML::XS::EXPORT = qw(Load Dump); | ||
9 | 1 | 600ns | @YAML::XS::EXPORT_OK = qw(LoadFile DumpFile); | ||
10 | 1 | 2µs | %YAML::XS::EXPORT_TAGS = ( | ||
11 | all => [qw(Dump Load LoadFile DumpFile)], | ||||
12 | ); | ||||
13 | our ($UseCode, $DumpCode, $LoadCode, $Boolean, $LoadBlessed, $Indent); | ||||
14 | # $YAML::XS::UseCode = 0; | ||||
15 | # $YAML::XS::DumpCode = 0; | ||||
16 | # $YAML::XS::LoadCode = 0; | ||||
17 | |||||
18 | 1 | 200ns | $YAML::XS::QuoteNumericStrings = 1; | ||
19 | |||||
20 | 2 | 103µs | 2 | 667µs | # spent 634µs (268+366) within YAML::XS::BEGIN@20 which was called:
# once (268µs+366µs) by RBM::BEGIN@8 at line 20 # spent 634µs making 1 call to YAML::XS::BEGIN@20
# spent 33µs making 1 call to Exporter::import |
21 | 2 | 1.10ms | 2 | 1.22ms | # spent 1.18ms (872µs+306µs) within YAML::XS::BEGIN@21 which was called:
# once (872µs+306µs) by RBM::BEGIN@8 at line 21 # spent 1.18ms making 1 call to YAML::XS::BEGIN@21
# spent 46µs making 1 call to Exporter::import |
22 | |||||
23 | sub DumpFile { | ||||
24 | my $OUT; | ||||
25 | my $filename = shift; | ||||
26 | if (openhandle $filename) { | ||||
27 | $OUT = $filename; | ||||
28 | } | ||||
29 | else { | ||||
30 | my $mode = '>'; | ||||
31 | if ($filename =~ /^\s*(>{1,2})\s*(.*)$/) { | ||||
32 | ($mode, $filename) = ($1, $2); | ||||
33 | } | ||||
34 | open $OUT, $mode, $filename | ||||
35 | or die "Can't open '$filename' for output:\n$!"; | ||||
36 | } | ||||
37 | local $/ = "\n"; # reset special to "sane" | ||||
38 | print $OUT YAML::XS::LibYAML::Dump(@_); | ||||
39 | } | ||||
40 | |||||
41 | # spent 12.7ms (2.03+10.7) within YAML::XS::LoadFile which was called 144 times, avg 88µs/call:
# 144 times (2.03ms+10.7ms) by RBM::load_config_file at line 32 of /root/tor-browser-build/rbm/lib/RBM.pm, avg 88µs/call | ||||
42 | 144 | 15µs | my $IN; | ||
43 | 144 | 32µs | my $filename = shift; | ||
44 | 144 | 296µs | 144 | 56µs | if (openhandle $filename) { # spent 56µs making 144 calls to Scalar::Util::openhandle, avg 390ns/call |
45 | $IN = $filename; | ||||
46 | } | ||||
47 | else { | ||||
48 | 144 | 1.27ms | 144 | 905µs | open $IN, $filename # spent 905µs making 144 calls to YAML::XS::CORE:open, avg 6µs/call |
49 | or die "Can't open '$filename' for input:\n$!"; | ||||
50 | } | ||||
51 | 432 | 11.2ms | 288 | 9.70ms | return YAML::XS::LibYAML::Load(do { local $/; local $_ = <$IN> }); # spent 8.84ms making 144 calls to YAML::XS::LibYAML::Load, avg 61µs/call
# spent 859µs making 144 calls to YAML::XS::CORE:readline, avg 6µs/call |
52 | } | ||||
53 | |||||
54 | |||||
55 | # XXX The following code should be moved from Perl to C. | ||||
56 | $YAML::XS::coderef2text = sub { | ||||
57 | my $coderef = shift; | ||||
58 | require B::Deparse; | ||||
59 | my $deparse = B::Deparse->new(); | ||||
60 | my $text; | ||||
61 | eval { | ||||
62 | local $^W = 0; | ||||
63 | $text = $deparse->coderef2text($coderef); | ||||
64 | }; | ||||
65 | if ($@) { | ||||
66 | warn "YAML::XS failed to dump code ref:\n$@"; | ||||
67 | return; | ||||
68 | } | ||||
69 | $text =~ s[BEGIN \{\$\{\^WARNING_BITS\} = "UUUUUUUUUUUU\\001"\}] | ||||
70 | [use warnings;]g; | ||||
71 | |||||
72 | return $text; | ||||
73 | 1 | 2µs | }; | ||
74 | |||||
75 | $YAML::XS::glob2hash = sub { | ||||
76 | my $hash = {}; | ||||
77 | for my $type (qw(PACKAGE NAME SCALAR ARRAY HASH CODE IO)) { | ||||
78 | my $value = *{$_[0]}{$type}; | ||||
79 | $value = $$value if $type eq 'SCALAR'; | ||||
80 | if (defined $value) { | ||||
81 | if ($type eq 'IO') { | ||||
82 | my @stats = qw(device inode mode links uid gid rdev size | ||||
83 | atime mtime ctime blksize blocks); | ||||
84 | undef $value; | ||||
85 | $value->{stat} = {}; | ||||
86 | map {$value->{stat}{shift @stats} = $_} stat(*{$_[0]}); | ||||
87 | $value->{fileno} = fileno(*{$_[0]}); | ||||
88 | { | ||||
89 | local $^W; | ||||
90 | $value->{tell} = tell(*{$_[0]}); | ||||
91 | } | ||||
92 | } | ||||
93 | $hash->{$type} = $value; | ||||
94 | } | ||||
95 | } | ||||
96 | return $hash; | ||||
97 | 1 | 2µs | }; | ||
98 | |||||
99 | # spent 79µs (26+53) within YAML::XS::BEGIN@99 which was called:
# once (26µs+53µs) by RBM::BEGIN@8 at line 116 | ||||
100 | '' => sub { qr{$_[0]} }, | ||||
101 | x => sub { qr{$_[0]}x }, | ||||
102 | i => sub { qr{$_[0]}i }, | ||||
103 | s => sub { qr{$_[0]}s }, | ||||
104 | m => sub { qr{$_[0]}m }, | ||||
105 | ix => sub { qr{$_[0]}ix }, | ||||
106 | sx => sub { qr{$_[0]}sx }, | ||||
107 | mx => sub { qr{$_[0]}mx }, | ||||
108 | si => sub { qr{$_[0]}si }, | ||||
109 | mi => sub { qr{$_[0]}mi }, | ||||
110 | ms => sub { qr{$_[0]}sm }, | ||||
111 | six => sub { qr{$_[0]}six }, | ||||
112 | mix => sub { qr{$_[0]}mix }, | ||||
113 | msx => sub { qr{$_[0]}msx }, | ||||
114 | msi => sub { qr{$_[0]}msi }, | ||||
115 | msix => sub { qr{$_[0]}msix }, | ||||
116 | 2 | 239µs | 2 | 132µs | }; # spent 79µs making 1 call to YAML::XS::BEGIN@99
# spent 53µs making 1 call to constant::import |
117 | |||||
118 | sub __qr_loader { | ||||
119 | if ($_[0] =~ /\A \(\? ([\^uixsm]*) (?:- (?:[ixsm]*))? : (.*) \) \z/x) { | ||||
120 | my ($flags, $re) = ($1, $2); | ||||
121 | $flags =~ s/^\^//; | ||||
122 | $flags =~ tr/u//d; | ||||
123 | my $sub = _QR_MAP->{$flags} || _QR_MAP->{''}; | ||||
124 | my $qr = &$sub($re); | ||||
125 | return $qr; | ||||
126 | } | ||||
127 | return qr/$_[0]/; | ||||
128 | } | ||||
129 | |||||
130 | sub __code_loader { | ||||
131 | my ($string) = @_; | ||||
132 | my $sub = eval "sub $string"; | ||||
133 | if ($@) { | ||||
134 | warn "YAML::XS failed to load sub: $@"; | ||||
135 | return sub {}; | ||||
136 | } | ||||
137 | return $sub; | ||||
138 | } | ||||
139 | |||||
140 | 1 | 8µs | 1; | ||
# spent 905µs within YAML::XS::CORE:open which was called 144 times, avg 6µs/call:
# 144 times (905µs+0s) by YAML::XS::LoadFile at line 48, avg 6µs/call | |||||
# spent 859µs within YAML::XS::CORE:readline which was called 144 times, avg 6µs/call:
# 144 times (859µs+0s) by YAML::XS::LoadFile at line 51, avg 6µs/call |