Profile of Test2/Event/Subtest.pm

← 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
Statements | Executed 13 statements in 442µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 10µs | 11µs | Test2::Event::Subtest::::BEGIN@2Test2::Event::Subtest::BEGIN@2
1 | 1 | 1 | 9µs | 25µs | Test2::Event::Subtest::::BEGIN@3Test2::Event::Subtest::BEGIN@3
1 | 1 | 1 | 7µs | 7µs | Test2::Event::Subtest::::BEGIN@7Test2::Event::Subtest::BEGIN@7
1 | 1 | 1 | 5µs | 17µs | Test2::Event::Subtest::::BEGIN@20Test2::Event::Subtest::BEGIN@20
1 | 1 | 1 | 4µs | 95µs | Test2::Event::Subtest::::BEGIN@8Test2::Event::Subtest::BEGIN@8
0 | 0 | 0 | 0s | 0s | Test2::Event::Subtest::::add_amnestyTest2::Event::Subtest::add_amnesty
0 | 0 | 0 | 0s | 0s | Test2::Event::Subtest::::facet_dataTest2::Event::Subtest::facet_data
0 | 0 | 0 | 0s | 0s | Test2::Event::Subtest::::initTest2::Event::Subtest::init
0 | 0 | 0 | 0s | 0s | Test2::Event::Subtest::::set_effective_passTest2::Event::Subtest::set_effective_pass
0 | 0 | 0 | 0s | 0s | Test2::Event::Subtest::::set_subeventsTest2::Event::Subtest::set_subevents
0 | 0 | 0 | 0s | 0s | Test2::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
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Test2::Event::Subtest;
2 | 2 | 18µs | 2 | 13µ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
3 | 2 | 34µs | 2 | 42µ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 |  |  |  |  |
5 | 1 | 300ns |  |  | our $VERSION = '1.302198';
6 |  |  |  |  |
7 | 2 | 22µs | 1 | 7µ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
8 | 2 | 71µs | 2 | 186µ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 |  |  |  |  |
10 |  |  |  |  | sub 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 |  |  |  |  | {
20 | 2 | 294µs | 2 | 30µ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 |  |  |  |  |
50 | 1 | 400ns |  |  | sub 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 |  |  |  |  |
66 |  |  |  |  | sub 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 |  |  |  |  |
85 |  |  |  |  | sub 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 |  |  |  |  |
101 | 1 | 2µs |  |  | 1;
102 |  |  |  |  |
103 |  |  |  |  | __END__