← 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/EventFacet/Trace.pm
StatementsExecuted 38 statements in 584µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111187µs1.51msTest2::EventFacet::Trace::::BEGIN@7Test2::EventFacet::Trace::BEGIN@7
11110µs11µsTest2::EventFacet::Trace::::BEGIN@2Test2::EventFacet::Trace::BEGIN@2
3119µs9µsTest2::EventFacet::Trace::::initTest2::EventFacet::Trace::init
1117µs24µsTest2::EventFacet::Trace::::BEGIN@3Test2::EventFacet::Trace::BEGIN@3
1115µs117µsTest2::EventFacet::Trace::::BEGIN@13Test2::EventFacet::Trace::BEGIN@13
1114µs16µsTest2::EventFacet::Trace::::BEGIN@16Test2::EventFacet::Trace::BEGIN@16
1114µs24µsTest2::EventFacet::Trace::::BEGIN@9Test2::EventFacet::Trace::BEGIN@9
1114µs44µsTest2::EventFacet::Trace::::BEGIN@10Test2::EventFacet::Trace::BEGIN@10
1114µs17µsTest2::EventFacet::Trace::::BEGIN@11Test2::EventFacet::Trace::BEGIN@11
1113µs3µsTest2::EventFacet::Trace::::snapshotTest2::EventFacet::Trace::snapshot
1112µs2µsTest2::EventFacet::Trace::::callTest2::EventFacet::Trace::call
0000s0sTest2::EventFacet::Trace::::alertTest2::EventFacet::Trace::alert
0000s0sTest2::EventFacet::Trace::::debugTest2::EventFacet::Trace::debug
0000s0sTest2::EventFacet::Trace::::fileTest2::EventFacet::Trace::file
0000s0sTest2::EventFacet::Trace::::full_callTest2::EventFacet::Trace::full_call
0000s0sTest2::EventFacet::Trace::::lineTest2::EventFacet::Trace::line
0000s0sTest2::EventFacet::Trace::::packageTest2::EventFacet::Trace::package
0000s0sTest2::EventFacet::Trace::::signatureTest2::EventFacet::Trace::signature
0000s0sTest2::EventFacet::Trace::::subnameTest2::EventFacet::Trace::subname
0000s0sTest2::EventFacet::Trace::::throwTest2::EventFacet::Trace::throw
0000s0sTest2::EventFacet::Trace::::warning_bitsTest2::EventFacet::Trace::warning_bits
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Test2::EventFacet::Trace;
2218µs213µs
# spent 11µs (10+2) within Test2::EventFacet::Trace::BEGIN@2 which was called: # once (10µs+2µs) by Test2::API::Instance::BEGIN@13 at line 2
use strict;
# spent 11µs making 1 call to Test2::EventFacet::Trace::BEGIN@2 # spent 2µs making 1 call to strict::import
3233µs240µs
# spent 24µs (7+17) within Test2::EventFacet::Trace::BEGIN@3 which was called: # once (7µs+17µs) by Test2::API::Instance::BEGIN@13 at line 3
use warnings;
# spent 24µs making 1 call to Test2::EventFacet::Trace::BEGIN@3 # spent 17µs making 1 call to warnings::import
4
51400nsour $VERSION = '1.302198';
6
7279µs11.51ms
# spent 1.51ms (187µs+1.32) within Test2::EventFacet::Trace::BEGIN@7 which was called: # once (187µs+1.32ms) by Test2::API::Instance::BEGIN@13 at line 7
BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) }
# spent 1.51ms making 1 call to Test2::EventFacet::Trace::BEGIN@7
8
9217µs244µs
# spent 24µs (4+20) within Test2::EventFacet::Trace::BEGIN@9 which was called: # once (4µs+20µs) by Test2::API::Instance::BEGIN@13 at line 9
use Test2::Util qw/get_tid pkg_to_file gen_uid/;
# spent 24µs making 1 call to Test2::EventFacet::Trace::BEGIN@9 # spent 20µs making 1 call to Exporter::import
10218µs285µs
# spent 44µs (4+40) within Test2::EventFacet::Trace::BEGIN@10 which was called: # once (4µs+40µs) by Test2::API::Instance::BEGIN@13 at line 10
use Time::HiRes qw/time/;
# spent 44µs making 1 call to Test2::EventFacet::Trace::BEGIN@10 # spent 40µs making 1 call to Time::HiRes::import
11218µs230µs
# spent 17µs (4+13) within Test2::EventFacet::Trace::BEGIN@11 which was called: # once (4µs+13µs) by Test2::API::Instance::BEGIN@13 at line 11
use Carp qw/confess/;
# spent 17µs making 1 call to Test2::EventFacet::Trace::BEGIN@11 # spent 13µs making 1 call to Exporter::import
12
13223µs2229µs
# spent 117µs (5+112) within Test2::EventFacet::Trace::BEGIN@13 which was called: # once (5µs+112µs) by Test2::API::Instance::BEGIN@13 at line 13
use Test2::Util::HashBase qw{^frame ^pid ^tid ^cid -hid -nested details -buffered -uuid -huuid <full_caller <stamp};
# spent 117µs making 1 call to Test2::EventFacet::Trace::BEGIN@13 # spent 112µs making 1 call to Test2::Util::HashBase::import
14
15{
163356µs229µs
# spent 16µs (4+12) within Test2::EventFacet::Trace::BEGIN@16 which was called: # once (4µs+12µs) by Test2::API::Instance::BEGIN@13 at line 16
no warnings 'once';
# spent 16µs making 1 call to Test2::EventFacet::Trace::BEGIN@16 # spent 12µs making 1 call to warnings::unimport
171900ns *DETAIL = \&DETAILS;
181200ns *detail = \&details;
191300ns *set_detail = \&set_details;
20}
21
22
# spent 9µs within Test2::EventFacet::Trace::init which was called 3 times, avg 3µs/call: # 3 times (9µs+0s) by Test2::Util::HashBase::_new at line 155 of Test2/Util/HashBase.pm, avg 3µs/call
sub init {
23 confess "The 'frame' attribute is required"
243700ns unless $_[0]->{+FRAME};
25
2632µs $_[0]->{+DETAILS} = delete $_[0]->{detail} if $_[0]->{detail};
27
2835µs unless (defined($_[0]->{+PID}) || defined($_[0]->{+TID}) || defined($_[0]->{+CID})) {
2922µs $_[0]->{+PID} = $$ unless defined $_[0]->{+PID};
302900ns $_[0]->{+TID} = get_tid() unless defined $_[0]->{+TID};
31 }
32}
33
34
# spent 3µs within Test2::EventFacet::Trace::snapshot which was called: # once (3µs+0s) by Test2::API::Context::send_ev2 at line 223 of Test2/API/Context.pm
sub snapshot {
351400ns my ($orig, @override) = @_;
3613µs bless {%$orig, @override}, __PACKAGE__;
37}
38
39sub signature {
40 my $self = shift;
41
42 # Signature is only valid if all of these fields are defined, there is no
43 # signature if any is missing. '0' is ok, but '' is not.
44 return join ':' => map { (defined($_) && length($_)) ? $_ : return undef } (
45 $self->{+CID},
46 $self->{+PID},
47 $self->{+TID},
48 $self->{+FRAME}->[1],
49 $self->{+FRAME}->[2],
50 );
51}
52
53sub debug {
54 my $self = shift;
55 return $self->{+DETAILS} if $self->{+DETAILS};
56 my ($pkg, $file, $line) = $self->call;
57 return "at $file line $line";
58}
59
60sub alert {
61 my $self = shift;
62 my ($msg) = @_;
63 warn $msg . ' ' . $self->debug . ".\n";
64}
65
66sub throw {
67 my $self = shift;
68 my ($msg) = @_;
69 die $msg . ' ' . $self->debug . ".\n";
70}
71
7213µs
# spent 2µs within Test2::EventFacet::Trace::call which was called: # once (2µs+0s) by Test::Builder::done_testing at line 595 of Test/Builder.pm
sub call { @{$_[0]->{+FRAME}} }
73
74sub full_call { @{$_[0]->{+FULL_CALLER}} }
75
76sub package { $_[0]->{+FRAME}->[0] }
77sub file { $_[0]->{+FRAME}->[1] }
78sub line { $_[0]->{+FRAME}->[2] }
79sub subname { $_[0]->{+FRAME}->[3] }
80
81sub warning_bits { $_[0]->{+FULL_CALLER} ? $_[0]->{+FULL_CALLER}->[9] : undef }
82
8313µs1;
84
85__END__