← Index
NYTProf Performance Profile   « line view »
For t/bug-md-11.t
  Run on Fri Mar 8 13:27:24 2024
Reported on Fri Mar 8 13:30:23 2024

Filename/home/micha/.plenv/versions/5.38.2/lib/perl5/site_perl/5.38.2/Test2/Event/Plan.pm
StatementsExecuted 25 statements in 416µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11110µs34µsTest2::Event::Plan::::facet_dataTest2::Event::Plan::facet_data
11110µs11µsTest2::Event::Plan::::BEGIN@2Test2::Event::Plan::BEGIN@2
1119µs25µsTest2::Event::Plan::::BEGIN@3Test2::Event::Plan::BEGIN@3
1117µs7µsTest2::Event::Plan::::BEGIN@8Test2::Event::Plan::BEGIN@8
1116µs19µsTest2::Event::Plan::::initTest2::Event::Plan::init
1114µs21µsTest2::Event::Plan::::BEGIN@11Test2::Event::Plan::BEGIN@11
1114µs53µsTest2::Event::Plan::::BEGIN@9Test2::Event::Plan::BEGIN@9
0000s0sTest2::Event::Plan::::sets_planTest2::Event::Plan::sets_plan
0000s0sTest2::Event::Plan::::summaryTest2::Event::Plan::summary
0000s0sTest2::Event::Plan::::terminateTest2::Event::Plan::terminate
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Test2::Event::Plan;
2218µs213µs
# spent 11µs (10+2) within Test2::Event::Plan::BEGIN@2 which was called: # once (10µs+2µs) by Test2::API::BEGIN@95 at line 2
use strict;
# spent 11µs making 1 call to Test2::Event::Plan::BEGIN@2 # spent 2µs making 1 call to strict::import
3234µs240µs
# spent 25µs (9+16) within Test2::Event::Plan::BEGIN@3 which was called: # once (9µs+16µs) by Test2::API::BEGIN@95 at line 3
use warnings;
# spent 25µs making 1 call to Test2::Event::Plan::BEGIN@3 # spent 16µs making 1 call to warnings::import
4
51400nsour $VERSION = '1.302198';
6
7
8221µs17µs
# spent 7µs within Test2::Event::Plan::BEGIN@8 which was called: # once (7µs+0s) by Test2::API::BEGIN@95 at line 8
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
# spent 7µs making 1 call to Test2::Event::Plan::BEGIN@8
9218µs2102µs
# spent 53µs (4+49) within Test2::Event::Plan::BEGIN@9 which was called: # once (4µs+49µs) by Test2::API::BEGIN@95 at line 9
use Test2::Util::HashBase qw{max directive reason};
# spent 53µs making 1 call to Test2::Event::Plan::BEGIN@9 # spent 49µs making 1 call to Test2::Util::HashBase::import
10
112292µs237µs
# spent 21µs (4+16) within Test2::Event::Plan::BEGIN@11 which was called: # once (4µs+16µs) by Test2::API::BEGIN@95 at line 11
use Carp qw/confess/;
# spent 21µs making 1 call to Test2::Event::Plan::BEGIN@11 # spent 16µs making 1 call to Exporter::import
12
1311µsmy %ALLOWED = (
14 'SKIP' => 1,
15 'NO PLAN' => 1,
16);
17
18
# spent 19µs (6+13) within Test2::Event::Plan::init which was called: # once (6µs+13µs) by Test2::Util::HashBase::_new at line 155 of Test2/Util/HashBase.pm
sub init {
1913µs if ($_[0]->{+DIRECTIVE}) {
20 $_[0]->{+DIRECTIVE} = 'SKIP' if $_[0]->{+DIRECTIVE} eq 'skip_all';
21 $_[0]->{+DIRECTIVE} = 'NO PLAN' if $_[0]->{+DIRECTIVE} eq 'no_plan';
22
23 confess "'" . $_[0]->{+DIRECTIVE} . "' is not a valid plan directive"
24 unless $ALLOWED{$_[0]->{+DIRECTIVE}};
25 }
26 else {
27 confess "Cannot have a reason without a directive!"
281500ns if defined $_[0]->{+REASON};
29
30 confess "No number of tests specified"
311500ns unless defined $_[0]->{+MAX};
32
33 confess "Plan test count '" . $_[0]->{+MAX} . "' does not appear to be a valid positive integer"
34115µs113µs unless $_[0]->{+MAX} =~ m/^\d+$/;
# spent 13µs making 1 call to CORE::match
35
3611µs $_[0]->{+DIRECTIVE} = '';
37 }
38}
39
40sub sets_plan {
41 my $self = shift;
42 return (
43 $self->{+MAX},
44 $self->{+DIRECTIVE},
45 $self->{+REASON},
46 );
47}
48
49sub terminate {
50 my $self = shift;
51 # On skip_all we want to terminate the hub
52 return 0 if $self->{+DIRECTIVE} && $self->{+DIRECTIVE} eq 'SKIP';
53 return undef;
54}
55
56sub summary {
57 my $self = shift;
58 my $max = $self->{+MAX};
59 my $directive = $self->{+DIRECTIVE};
60 my $reason = $self->{+REASON};
61
62 return "Plan is $max assertions"
63 if $max || !$directive;
64
65 return "Plan is '$directive', $reason"
66 if $reason;
67
68 return "Plan is '$directive'";
69}
70
71
# spent 34µs (10+24) within Test2::Event::Plan::facet_data which was called: # once (10µs+24µs) by Test2::Hub::process at line 343 of Test2/Hub.pm
sub facet_data {
721300ns my $self = shift;
73
7413µs124µs my $out = $self->common_facet_data;
# spent 24µs making 1 call to Test2::Event::common_facet_data
75
76 $out->{control}->{terminate} = $self->{+DIRECTIVE} eq 'SKIP' ? 0 : undef
7712µs unless defined $out->{control}->{terminate};
78
7911µs $out->{plan} = {count => $self->{+MAX}};
801500ns $out->{plan}->{details} = $self->{+REASON} if defined $self->{+REASON};
81
821700ns if (my $dir = $self->{+DIRECTIVE}) {
83 $out->{plan}->{skip} = 1 if $dir eq 'SKIP';
84 $out->{plan}->{none} = 1 if $dir eq 'NO PLAN';
85 }
86
8712µs return $out;
88}
89
90
9113µs1;
92
93__END__