← 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/Ok.pm
StatementsExecuted 13 statements in 424µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1111.23ms4.67msTest2::Event::Ok::::BEGIN@8Test2::Event::Ok::BEGIN@8
11115µs17µsTest2::Event::Ok::::BEGIN@2Test2::Event::Ok::BEGIN@2
1115µs64µsTest2::Event::Ok::::BEGIN@9Test2::Event::Ok::BEGIN@9
1115µs19µsTest2::Event::Ok::::BEGIN@22Test2::Event::Ok::BEGIN@22
1115µs22µsTest2::Event::Ok::::BEGIN@3Test2::Event::Ok::BEGIN@3
0000s0sTest2::Event::Ok::::causes_failTest2::Event::Ok::causes_fail
0000s0sTest2::Event::Ok::::extra_amnestyTest2::Event::Ok::extra_amnesty
0000s0sTest2::Event::Ok::::facet_dataTest2::Event::Ok::facet_data
0000s0sTest2::Event::Ok::::increments_countTest2::Event::Ok::increments_count
0000s0sTest2::Event::Ok::::initTest2::Event::Ok::init
0000s0sTest2::Event::Ok::::set_todoTest2::Event::Ok::set_todo
0000s0sTest2::Event::Ok::::summaryTest2::Event::Ok::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::Ok;
2223µs219µs
# spent 17µs (15+2) within Test2::Event::Ok::BEGIN@2 which was called: # once (15µs+2µs) by Test2::API::BEGIN@92 at line 2
use strict;
# spent 17µs making 1 call to Test2::Event::Ok::BEGIN@2 # spent 2µs making 1 call to strict::import
3237µs240µs
# spent 22µs (5+18) within Test2::Event::Ok::BEGIN@3 which was called: # once (5µs+18µs) by Test2::API::BEGIN@92 at line 3
use warnings;
# spent 22µs making 1 call to Test2::Event::Ok::BEGIN@3 # spent 18µs making 1 call to warnings::import
4
51300nsour $VERSION = '1.302198';
6
7
82102µs14.67ms
# spent 4.67ms (1.23+3.45) within Test2::Event::Ok::BEGIN@8 which was called: # once (1.23ms+3.45ms) by Test2::API::BEGIN@92 at line 8
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
# spent 4.67ms making 1 call to Test2::Event::Ok::BEGIN@8
912µs159µs
# spent 64µs (5+59) within Test2::Event::Ok::BEGIN@9 which was called: # once (5µs+59µs) by Test2::API::BEGIN@92 at line 11
use Test2::Util::HashBase qw{
# spent 59µs making 1 call to Test2::Util::HashBase::import
10 pass effective_pass name todo
11155µs164µs};
# spent 64µs making 1 call to Test2::Event::Ok::BEGIN@9
12
13sub init {
14 my $self = shift;
15
16 # Do not store objects here, only true or false
17 $self->{+PASS} = $self->{+PASS} ? 1 : 0;
18 $self->{+EFFECTIVE_PASS} = $self->{+PASS} || (defined($self->{+TODO}) ? 1 : 0);
19}
20
21{
222202µs233µs
# spent 19µs (5+14) within Test2::Event::Ok::BEGIN@22 which was called: # once (5µs+14µs) by Test2::API::BEGIN@92 at line 22
no warnings 'redefine';
# spent 19µs making 1 call to Test2::Event::Ok::BEGIN@22 # spent 14µs making 1 call to warnings::unimport
23 sub set_todo {
24 my $self = shift;
25 my ($todo) = @_;
26 $self->{+TODO} = $todo;
27 $self->{+EFFECTIVE_PASS} = defined($todo) ? 1 : $self->{+PASS};
28 }
29}
30
311400nssub increments_count { 1 };
32
33sub causes_fail { !$_[0]->{+EFFECTIVE_PASS} }
34
35sub summary {
36 my $self = shift;
37
38 my $name = $self->{+NAME} || "Nameless Assertion";
39
40 my $todo = $self->{+TODO};
41 if ($todo) {
42 $name .= " (TODO: $todo)";
43 }
44 elsif (defined $todo) {
45 $name .= " (TODO)"
46 }
47
48 return $name;
49}
50
51sub extra_amnesty {
52 my $self = shift;
53 return unless defined($self->{+TODO}) || ($self->{+EFFECTIVE_PASS} && !$self->{+PASS});
54 return {
55 tag => 'TODO',
56 details => $self->{+TODO},
57 };
58}
59
60sub facet_data {
61 my $self = shift;
62
63 my $out = $self->common_facet_data;
64
65 $out->{assert} = {
66 no_debug => 1, # Legacy behavior
67 pass => $self->{+PASS},
68 details => $self->{+NAME},
69 };
70
71 if (my @exra_amnesty = $self->extra_amnesty) {
72 my %seen;
73
74 # It is possible the extra amnesty can be a duplicate, so filter it.
75 $out->{amnesty} = [
76 grep { !$seen{defined($_->{tag}) ? $_->{tag} : ''}->{defined($_->{details}) ? $_->{details} : ''}++ }
77 @exra_amnesty,
78 @{$out->{amnesty}},
79 ];
80 }
81
82 return $out;
83}
84
8512µs1;
86
87__END__