Profile of Test2/Event/Ok.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/Ok.pm
Statements | Executed 13 statements in 424µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 1.23ms | 4.67ms | Test2::Event::Ok::::BEGIN@8Test2::Event::Ok::BEGIN@8
1 | 1 | 1 | 15µs | 17µs | Test2::Event::Ok::::BEGIN@2Test2::Event::Ok::BEGIN@2
1 | 1 | 1 | 5µs | 64µs | Test2::Event::Ok::::BEGIN@9Test2::Event::Ok::BEGIN@9
1 | 1 | 1 | 5µs | 19µs | Test2::Event::Ok::::BEGIN@22Test2::Event::Ok::BEGIN@22
1 | 1 | 1 | 5µs | 22µs | Test2::Event::Ok::::BEGIN@3Test2::Event::Ok::BEGIN@3
0 | 0 | 0 | 0s | 0s | Test2::Event::Ok::::causes_failTest2::Event::Ok::causes_fail
0 | 0 | 0 | 0s | 0s | Test2::Event::Ok::::extra_amnestyTest2::Event::Ok::extra_amnesty
0 | 0 | 0 | 0s | 0s | Test2::Event::Ok::::facet_dataTest2::Event::Ok::facet_data
0 | 0 | 0 | 0s | 0s | Test2::Event::Ok::::increments_countTest2::Event::Ok::increments_count
0 | 0 | 0 | 0s | 0s | Test2::Event::Ok::::initTest2::Event::Ok::init
0 | 0 | 0 | 0s | 0s | Test2::Event::Ok::::set_todoTest2::Event::Ok::set_todo
0 | 0 | 0 | 0s | 0s | Test2::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
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Test2::Event::Ok;
2 | 2 | 23µs | 2 | 19µ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
3 | 2 | 37µs | 2 | 40µ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 |  |  |  |  |
5 | 1 | 300ns |  |  | our $VERSION = '1.302198';
6 |  |  |  |  |
7 |  |  |  |  |
8 | 2 | 102µs | 1 | 4.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
9 | 1 | 2µs | 1 | 59µ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
11 | 1 | 55µs | 1 | 64µs | }; # spent 64µs making 1 call to Test2::Event::Ok::BEGIN@9
12 |  |  |  |  |
13 |  |  |  |  | sub 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 |  |  |  |  | {
22 | 2 | 202µs | 2 | 33µ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 |  |  |  |  |
31 | 1 | 400ns |  |  | sub increments_count { 1 };
32 |  |  |  |  |
33 |  |  |  |  | sub causes_fail { !$_[0]->{+EFFECTIVE_PASS} }
34 |  |  |  |  |
35 |  |  |  |  | sub 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 |  |  |  |  |
51 |  |  |  |  | sub 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 |  |  |  |  |
60 |  |  |  |  | sub 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 |  |  |  |  |
85 | 1 | 2µs |  |  | 1;
86 |  |  |  |  |
87 |  |  |  |  | __END__