blib/lib/Devel/NYTProf/Core.pm

filter: Statementstmt 76.1% 16 / 21 Branchbran 41.6% 5 / 12 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 54.7% 23 / 42 CC 1 SCAR 0.1
CC
1
Cov
55%
__ANON__
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« t/test51-enable.p ↑ Summary t/test03.p »
1 # vim: ts=8 sw=4 expandtab:
2 ##########################################################
3 # This script is part of the Devel::NYTProf distribution
4 #
5 # Copyright, contact and other information can be found
6 # at the bottom of this file, or by going to:
7 # http://metacpan.org/release/Devel-NYTProf/
8 #
9 ###########################################################
10 package Devel::NYTProf::Core;
11  
12  
13 706 ▶use XSLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 706 our $VERSION = '6.16'; # increment with XS changes too
16  
17 705 XSLoader::load('Devel::NYTProf', $VERSION);
18  
19 # Fudging for https://rt.cpan.org/Ticket/Display.html?id=82256
20 705 ▶$Devel::NYTProf::StrEvalTestPad = ($] <= 5.017004) ? ";\n" : "";
Branch: 1 branch
BranchTrueFalseTotal
$] <= 5.017004 ? : 0 705 705
21  
22 705 ▶if (my $NYTPROF = $ENV{NYTPROF}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $NYTPROF = $ENV{"NYTPROF"}) 654 51 705
23 654 for my $optval ( $NYTPROF =~ /((?:[^\\:]+|\\.)+)/g) {
24 5872 my ($opt, $val) = $optval =~ /^((?:[^\\=]+|\\.)+)=((?:[^\\=]+|\\.)+)\z/;
25 5872 s/\\(.)/$1/g for $opt, $val;
26  
27 5872 ▶ if ($opt eq 'sigexit') {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt eq "sigexit") 0 5872 5872
28 # Intercept sudden process exit caused by signals
29 0 ▶ my @sigs = ($val eq '1') ? qw(INT HUP PIPE BUS SEGV) : split(/,/, $val);
Branch: 1 branch
BranchTrueFalseTotal
$val eq '1' ? : 0 0 0
30 0 ▶ $SIG{uc $_} = sub { DB::finish_profile(); exit 1; } for @sigs;
Subroutine __ANON__: called CC=1 SCAR=0.4
31 0 next; # no need to tell the XS code about this
32 }
33  
34 5872 ▶ if ($opt eq 'posix_exit') {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt eq "posix_exit") 0 5872 5872
35 # Intercept sudden process exit caused by POSIX::_exit() call.
36 # Should only be needed if subs=0. We delay till after profiling
37 # has probably started to minimize the effect on the profile.
38 0 ▶ eval q{ INIT {
Branch: 1 branch
BranchTrueFalseTotal
if $val 0 0 0
Condition0%0/5
$val && (eval " INIT {\n require POSIX;\n my \$orig = \\&POSIX::_exit;\n local \$^W = 0; # avoid sub redef warning\n *POSIX::_exit = sub { DB::finish_profile(); \$orig->(\@_) };\n } 1 " || die())
!ll&&!rl&&r
000
eval " INIT {\n require POSIX;\n my \$orig = \\&POSIX::_exit;\n local \$^W = 0; # avoid sub redef warning\n *POSIX::_exit = sub { DB::finish_profile(); \$orig->(\@_) };\n } 1 " or die
l!l
00
MC/DC0%0/2
$val && (eval " INIT {\n require POSIX;\n my \$orig = \\&POSIX::_exit;\n local \$^W = 0; # avoid sub redef warning\n *POSIX::_exit = sub { DB::finish_profile(); \$orig->(\@_) };\n } 1 " || die())
$val eval " INIT {\n require POSIX;\n my \$orig = \\&POSIX::_exit;\n local \$^W = 0; # avoid sub redef warning\n *POSIX::_exit = sub { DB::finish_profile(); \$orig->(\@_) };\n } 1 "
Truth table0%0/3
A && B
A= $valB= eval " INIT {\n require POSIX;\n my \$orig = \\&POSIX::_exit;\n local \$^W = 0; # avoid sub redef warning\n *POSIX::_exit = sub { DB::finish_profile(); \$orig->(\@_) };\n } 1 "
ABresult
0X0
100
111
39 require POSIX;
40 my $orig = \&POSIX::_exit;
41 local $^W = 0; # avoid sub redef warning
42 *POSIX::_exit = sub { DB::finish_profile(); $orig->(@_) };
43 } 1 } or die if $val;
44 0 next; # no need to tell the XS code about this
45 }
46  
47 5872 DB::set_option($opt, $val);
48 }
49 }
50  
51 705 1;
52  
53 __END__
« t/test51-enable.p ↑ Summary t/test03.p »