← 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
StatementsExecuted 14 statements in 464µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11195µs124µsTest2::Hub::Interceptor::::BEGIN@8Test2::Hub::Interceptor::BEGIN@8
11112µs12µsTest2::Hub::Interceptor::::BEGIN@10Test2::Hub::Interceptor::BEGIN@10
11110µs11µsTest2::Hub::Interceptor::::BEGIN@2Test2::Hub::Interceptor::BEGIN@2
1115µs18µsTest2::Hub::Interceptor::::BEGIN@93Test2::Hub::Interceptor::BEGIN@93
1114µs45µsTest2::Hub::Interceptor::::BEGIN@11Test2::Hub::Interceptor::BEGIN@11
1113µs20µsTest2::Hub::Interceptor::::BEGIN@3Test2::Hub::Interceptor::BEGIN@3
0000s0sTest2::Hub::Interceptor::::clean_inheritedTest2::Hub::Interceptor::clean_inherited
0000s0sTest2::Hub::Interceptor::::inheritTest2::Hub::Interceptor::inherit
0000s0sTest2::Hub::Interceptor::::initTest2::Hub::Interceptor::init
0000s0sTest2::Hub::Interceptor::::restore_inheritedTest2::Hub::Interceptor::restore_inherited
0000s0sTest2::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
1package Test2::Hub::Interceptor;
2219µs213µ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
3227µs236µ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
51300nsour $VERSION = '1.302198';
6
7
8279µs1124µ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
10226µs112µ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
112265µs286µ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
13sub init {
14 my $self = shift;
15 $self->SUPER::init();
16 $self->{+NESTED} = 0;
17}
18
19sub 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
44sub 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
66sub 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
88sub terminate {
89 my $self = shift;
90 my ($code) = @_;
91
92 eval {
93246µs232µ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
10212µs1;
103
104__END__