← 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/Subtest.pm
StatementsExecuted 13 statements in 442µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11110µs11µsTest2::Event::Subtest::::BEGIN@2Test2::Event::Subtest::BEGIN@2
1119µs25µsTest2::Event::Subtest::::BEGIN@3Test2::Event::Subtest::BEGIN@3
1117µs7µsTest2::Event::Subtest::::BEGIN@7Test2::Event::Subtest::BEGIN@7
1115µs17µsTest2::Event::Subtest::::BEGIN@20Test2::Event::Subtest::BEGIN@20
1114µs95µsTest2::Event::Subtest::::BEGIN@8Test2::Event::Subtest::BEGIN@8
0000s0sTest2::Event::Subtest::::add_amnestyTest2::Event::Subtest::add_amnesty
0000s0sTest2::Event::Subtest::::facet_dataTest2::Event::Subtest::facet_data
0000s0sTest2::Event::Subtest::::initTest2::Event::Subtest::init
0000s0sTest2::Event::Subtest::::set_effective_passTest2::Event::Subtest::set_effective_pass
0000s0sTest2::Event::Subtest::::set_subeventsTest2::Event::Subtest::set_subevents
0000s0sTest2::Event::Subtest::::summaryTest2::Event::Subtest::summary
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::Subtest;
2218µs213µs
# spent 11µs (10+2) within Test2::Event::Subtest::BEGIN@2 which was called: # once (10µs+2µs) by Test2::API::BEGIN@100 at line 2
use strict;
# spent 11µs making 1 call to Test2::Event::Subtest::BEGIN@2 # spent 2µs making 1 call to strict::import
3234µs242µs
# spent 25µs (9+17) within Test2::Event::Subtest::BEGIN@3 which was called: # once (9µs+17µs) by Test2::API::BEGIN@100 at line 3
use warnings;
# spent 25µs making 1 call to Test2::Event::Subtest::BEGIN@3 # spent 17µs making 1 call to warnings::import
4
51300nsour $VERSION = '1.302198';
6
7222µs17µs
# spent 7µs within Test2::Event::Subtest::BEGIN@7 which was called: # once (7µs+0s) by Test2::API::BEGIN@100 at line 7
BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) }
# spent 7µs making 1 call to Test2::Event::Subtest::BEGIN@7
8271µs2186µs
# spent 95µs (4+91) within Test2::Event::Subtest::BEGIN@8 which was called: # once (4µs+91µs) by Test2::API::BEGIN@100 at line 8
use Test2::Util::HashBase qw{subevents buffered subtest_id subtest_uuid start_stamp stop_stamp};
# spent 95µs making 1 call to Test2::Event::Subtest::BEGIN@8 # spent 91µs making 1 call to Test2::Util::HashBase::import
9
10sub init {
11 my $self = shift;
12 $self->SUPER::init();
13 $self->{+SUBEVENTS} ||= [];
14 if ($self->{+EFFECTIVE_PASS}) {
15 $_->set_effective_pass(1) for grep { $_->can('effective_pass') } @{$self->{+SUBEVENTS}};
16 }
17}
18
19{
202294µs230µs
# spent 17µs (5+13) within Test2::Event::Subtest::BEGIN@20 which was called: # once (5µs+13µs) by Test2::API::BEGIN@100 at line 20
no warnings 'redefine';
# spent 17µs making 1 call to Test2::Event::Subtest::BEGIN@20 # spent 13µs making 1 call to warnings::unimport
21
22 sub set_subevents {
23 my $self = shift;
24 my @subevents = @_;
25
26 if ($self->{+EFFECTIVE_PASS}) {
27 $_->set_effective_pass(1) for grep { $_->can('effective_pass') } @subevents;
28 }
29
30 $self->{+SUBEVENTS} = \@subevents;
31 }
32
33 sub set_effective_pass {
34 my $self = shift;
35 my ($pass) = @_;
36
37 if ($pass) {
38 $_->set_effective_pass(1) for grep { $_->can('effective_pass') } @{$self->{+SUBEVENTS}};
39 }
40 elsif ($self->{+EFFECTIVE_PASS} && !$pass) {
41 for my $s (grep { $_->can('effective_pass') } @{$self->{+SUBEVENTS}}) {
42 $_->set_effective_pass(0) unless $s->can('todo') && defined $s->todo;
43 }
44 }
45
46 $self->{+EFFECTIVE_PASS} = $pass;
47 }
48}
49
501400nssub summary {
51 my $self = shift;
52
53 my $name = $self->{+NAME} || "Nameless Subtest";
54
55 my $todo = $self->{+TODO};
56 if ($todo) {
57 $name .= " (TODO: $todo)";
58 }
59 elsif (defined $todo) {
60 $name .= " (TODO)";
61 }
62
63 return $name;
64}
65
66sub facet_data {
67 my $self = shift;
68
69 my $out = $self->SUPER::facet_data();
70
71 my $start = $self->start_stamp;
72 my $stop = $self->stop_stamp;
73
74 $out->{parent} = {
75 hid => $self->subtest_id,
76 children => [map {$_->facet_data} @{$self->{+SUBEVENTS}}],
77 buffered => $self->{+BUFFERED},
78 $start ? (start_stamp => $start) : (),
79 $stop ? (stop_stamp => $stop) : (),
80 };
81
82 return $out;
83}
84
85sub add_amnesty {
86 my $self = shift;
87
88 for my $am (@_) {
89 $am = {%$am} if ref($am) ne 'ARRAY';
90 $am = Test2::EventFacet::Amnesty->new($am);
91
92 push @{$self->{+AMNESTY}} => $am;
93
94 for my $e (@{$self->{+SUBEVENTS}}) {
95 $e->add_amnesty($am->clone(inherited => 1));
96 }
97 }
98}
99
100
10112µs1;
102
103__END__