Profile of Test2/Hub/Interceptor.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/Hub/Interceptor.pm
Statements | Executed 14 statements in 464µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 95µs | 124µs | Test2::Hub::Interceptor::::BEGIN@8Test2::Hub::Interceptor::BEGIN@8
1 | 1 | 1 | 12µs | 12µs | Test2::Hub::Interceptor::::BEGIN@10Test2::Hub::Interceptor::BEGIN@10
1 | 1 | 1 | 10µs | 11µs | Test2::Hub::Interceptor::::BEGIN@2Test2::Hub::Interceptor::BEGIN@2
1 | 1 | 1 | 5µs | 18µs | Test2::Hub::Interceptor::::BEGIN@93Test2::Hub::Interceptor::BEGIN@93
1 | 1 | 1 | 4µs | 45µs | Test2::Hub::Interceptor::::BEGIN@11Test2::Hub::Interceptor::BEGIN@11
1 | 1 | 1 | 3µs | 20µs | Test2::Hub::Interceptor::::BEGIN@3Test2::Hub::Interceptor::BEGIN@3
0 | 0 | 0 | 0s | 0s | Test2::Hub::Interceptor::::clean_inheritedTest2::Hub::Interceptor::clean_inherited
0 | 0 | 0 | 0s | 0s | Test2::Hub::Interceptor::::inheritTest2::Hub::Interceptor::inherit
0 | 0 | 0 | 0s | 0s | Test2::Hub::Interceptor::::initTest2::Hub::Interceptor::init
0 | 0 | 0 | 0s | 0s | Test2::Hub::Interceptor::::restore_inheritedTest2::Hub::Interceptor::restore_inherited
0 | 0 | 0 | 0s | 0s | Test2::Hub::Interceptor::::terminateTest2::Hub::Interceptor::terminate

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::Hub::Interceptor;
2 | 2 | 19µs | 2 | 13µs | # spent 11µs (10+2) within Test2::Hub::Interceptor::BEGIN@2 which was called: # once (10µs+2µs) by Test2::API::BEGIN@89 at line 2 use strict; # spent 11µs making 1 call to Test2::Hub::Interceptor::BEGIN@2 # spent 2µs making 1 call to strict::import
3 | 2 | 27µs | 2 | 36µs | # spent 20µs (3+16) within Test2::Hub::Interceptor::BEGIN@3 which was called: # once (3µs+16µs) by Test2::API::BEGIN@89 at line 3 use warnings; # spent 20µs making 1 call to Test2::Hub::Interceptor::BEGIN@3 # spent 16µs making 1 call to warnings::import
4 |  |  |  |  |
5 | 1 | 300ns |  |  | our $VERSION = '1.302198';
6 |  |  |  |  |
7 |  |  |  |  |
8 | 2 | 79µs | 1 | 124µs | # spent 124µs (95+30) within Test2::Hub::Interceptor::BEGIN@8 which was called: # once (95µs+30µs) by Test2::API::BEGIN@89 at line 8 use Test2::Hub::Interceptor::Terminator(); # spent 124µs making 1 call to Test2::Hub::Interceptor::BEGIN@8
9 |  |  |  |  |
10 | 2 | 26µs | 1 | 12µs | # spent 12µs within Test2::Hub::Interceptor::BEGIN@10 which was called: # once (12µs+0s) by Test2::API::BEGIN@89 at line 10 BEGIN { require Test2::Hub; our @ISA = qw(Test2::Hub) } # spent 12µs making 1 call to Test2::Hub::Interceptor::BEGIN@10
11 | 2 | 265µs | 2 | 86µs | # spent 45µs (4+41) within Test2::Hub::Interceptor::BEGIN@11 which was called: # once (4µs+41µs) by Test2::API::BEGIN@89 at line 11 use Test2::Util::HashBase; # spent 45µs making 1 call to Test2::Hub::Interceptor::BEGIN@11 # spent 41µs making 1 call to Test2::Util::HashBase::import
12 |  |  |  |  |
13 |  |  |  |  | sub init {
14 |  |  |  |  | my $self = shift;
15 |  |  |  |  | $self->SUPER::init();
16 |  |  |  |  | $self->{+NESTED} = 0;
17 |  |  |  |  | }
18 |  |  |  |  |
19 |  |  |  |  | sub inherit {
20 |  |  |  |  | my $self = shift;
21 |  |  |  |  | my ($from, %params) = @_;
22 |  |  |  |  |
23 |  |  |  |  | $self->{+NESTED} = 0;
24 |  |  |  |  |
25 |  |  |  |  | if ($from->{+IPC} && !$self->{+IPC} && !exists($params{ipc})) {
26 |  |  |  |  | my $ipc = $from->{+IPC};
27 |  |  |  |  | $self->{+IPC} = $ipc;
28 |  |  |  |  | $ipc->add_hub($self->{+HID});
29 |  |  |  |  | }
30 |  |  |  |  |
31 |  |  |  |  | if (my $ls = $from->{+_LISTENERS}) {
32 |  |  |  |  | push @{$self->{+_LISTENERS}} => grep { $_->{intercept_inherit} } @$ls;
33 |  |  |  |  | }
34 |  |  |  |  |
35 |  |  |  |  | if (my $pfs = $from->{+_PRE_FILTERS}) {
36 |  |  |  |  | push @{$self->{+_PRE_FILTERS}} => grep { $_->{intercept_inherit} } @$pfs;
37 |  |  |  |  | }
38 |  |  |  |  |
39 |  |  |  |  | if (my $fs = $from->{+_FILTERS}) {
40 |  |  |  |  | push @{$self->{+_FILTERS}} => grep { $_->{intercept_inherit} } @$fs;
41 |  |  |  |  | }
42 |  |  |  |  | }
43 |  |  |  |  |
44 |  |  |  |  | sub clean_inherited {
45 |  |  |  |  | my $self = shift;
46 |  |  |  |  | my %params = @_;
47 |  |  |  |  |
48 |  |  |  |  | my @sets = (
49 |  |  |  |  | $self->{+_LISTENERS},
50 |  |  |  |  | $self->{+_PRE_FILTERS},
51 |  |  |  |  | $self->{+_FILTERS},
52 |  |  |  |  | );
53 |  |  |  |  |
54 |  |  |  |  | for my $set (@sets) {
55 |  |  |  |  | next unless $set;
56 |  |  |  |  |
57 |  |  |  |  | for my $i (@$set) {
58 |  |  |  |  | my $cbs = $i->{intercept_inherit} or next;
59 |  |  |  |  | next unless ref($cbs) eq 'HASH';
60 |  |  |  |  | my $cb = $cbs->{clean} or next;
61 |  |  |  |  | $cb->(%params);
62 |  |  |  |  | }
63 |  |  |  |  | }
64 |  |  |  |  | }
65 |  |  |  |  |
66 |  |  |  |  | sub restore_inherited {
67 |  |  |  |  | my $self = shift;
68 |  |  |  |  | my %params = @_;
69 |  |  |  |  |
70 |  |  |  |  | my @sets = (
71 |  |  |  |  | $self->{+_FILTERS},
72 |  |  |  |  | $self->{+_PRE_FILTERS},
73 |  |  |  |  | $self->{+_LISTENERS},
74 |  |  |  |  | );
75 |  |  |  |  |
76 |  |  |  |  | for my $set (@sets) {
77 |  |  |  |  | next unless $set;
78 |  |  |  |  |
79 |  |  |  |  | for my $i (@$set) {
80 |  |  |  |  | my $cbs = $i->{intercept_inherit} or next;
81 |  |  |  |  | next unless ref($cbs) eq 'HASH';
82 |  |  |  |  | my $cb = $cbs->{restore} or next;
83 |  |  |  |  | $cb->(%params);
84 |  |  |  |  | }
85 |  |  |  |  | }
86 |  |  |  |  | }
87 |  |  |  |  |
88 |  |  |  |  | sub terminate {
89 |  |  |  |  | my $self = shift;
90 |  |  |  |  | my ($code) = @_;
91 |  |  |  |  |
92 |  |  |  |  | eval {
93 | 2 | 46µs | 2 | 32µs | # spent 18µs (5+14) within Test2::Hub::Interceptor::BEGIN@93 which was called: # once (5µs+14µs) by Test2::API::BEGIN@89 at line 93 no warnings 'exiting'; # spent 18µs making 1 call to Test2::Hub::Interceptor::BEGIN@93 # spent 14µs making 1 call to warnings::unimport
94 |  |  |  |  | last T2_SUBTEST_WRAPPER;
95 |  |  |  |  | };
96 |  |  |  |  | my $err = $@;
97 |  |  |  |  |
98 |  |  |  |  | # Fallback
99 |  |  |  |  | die bless(\$err, 'Test2::Hub::Interceptor::Terminator');
100 |  |  |  |  | }
101 |  |  |  |  |
102 | 1 | 2µs |  |  | 1;
103 |  |  |  |  |
104 |  |  |  |  | __END__