Profile of Test2/EventFacet/Trace.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/EventFacet/Trace.pm
Statements | Executed 38 statements in 584µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 187µs | 1.51ms | Test2::EventFacet::Trace::::BEGIN@7Test2::EventFacet::Trace::BEGIN@7
1 | 1 | 1 | 10µs | 11µs | Test2::EventFacet::Trace::::BEGIN@2Test2::EventFacet::Trace::BEGIN@2
3 | 1 | 1 | 9µs | 9µs | Test2::EventFacet::Trace::::initTest2::EventFacet::Trace::init
1 | 1 | 1 | 7µs | 24µs | Test2::EventFacet::Trace::::BEGIN@3Test2::EventFacet::Trace::BEGIN@3
1 | 1 | 1 | 5µs | 117µs | Test2::EventFacet::Trace::::BEGIN@13Test2::EventFacet::Trace::BEGIN@13
1 | 1 | 1 | 4µs | 16µs | Test2::EventFacet::Trace::::BEGIN@16Test2::EventFacet::Trace::BEGIN@16
1 | 1 | 1 | 4µs | 24µs | Test2::EventFacet::Trace::::BEGIN@9Test2::EventFacet::Trace::BEGIN@9
1 | 1 | 1 | 4µs | 44µs | Test2::EventFacet::Trace::::BEGIN@10Test2::EventFacet::Trace::BEGIN@10
1 | 1 | 1 | 4µs | 17µs | Test2::EventFacet::Trace::::BEGIN@11Test2::EventFacet::Trace::BEGIN@11
1 | 1 | 1 | 3µs | 3µs | Test2::EventFacet::Trace::::snapshotTest2::EventFacet::Trace::snapshot
1 | 1 | 1 | 2µs | 2µs | Test2::EventFacet::Trace::::callTest2::EventFacet::Trace::call
0 | 0 | 0 | 0s | 0s | Test2::EventFacet::Trace::::alertTest2::EventFacet::Trace::alert
0 | 0 | 0 | 0s | 0s | Test2::EventFacet::Trace::::debugTest2::EventFacet::Trace::debug
0 | 0 | 0 | 0s | 0s | Test2::EventFacet::Trace::::fileTest2::EventFacet::Trace::file
0 | 0 | 0 | 0s | 0s | Test2::EventFacet::Trace::::full_callTest2::EventFacet::Trace::full_call
0 | 0 | 0 | 0s | 0s | Test2::EventFacet::Trace::::lineTest2::EventFacet::Trace::line
0 | 0 | 0 | 0s | 0s | Test2::EventFacet::Trace::::packageTest2::EventFacet::Trace::package
0 | 0 | 0 | 0s | 0s | Test2::EventFacet::Trace::::signatureTest2::EventFacet::Trace::signature
0 | 0 | 0 | 0s | 0s | Test2::EventFacet::Trace::::subnameTest2::EventFacet::Trace::subname
0 | 0 | 0 | 0s | 0s | Test2::EventFacet::Trace::::throwTest2::EventFacet::Trace::throw
0 | 0 | 0 | 0s | 0s | Test2::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
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Test2::EventFacet::Trace;
2 | 2 | 18µs | 2 | 13µ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
3 | 2 | 33µs | 2 | 40µ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 |  |  |  |  |
5 | 1 | 400ns |  |  | our $VERSION = '1.302198';
6 |  |  |  |  |
7 | 2 | 79µs | 1 | 1.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 |  |  |  |  |
9 | 2 | 17µs | 2 | 44µ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
10 | 2 | 18µs | 2 | 85µ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
11 | 2 | 18µs | 2 | 30µ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 |  |  |  |  |
13 | 2 | 23µs | 2 | 229µ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 |  |  |  |  | {
16 | 3 | 356µs | 2 | 29µ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
17 | 1 | 900ns |  |  | *DETAIL = \&DETAILS;
18 | 1 | 200ns |  |  | *detail = \&details;
19 | 1 | 300ns |  |  | *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"
24 | 3 | 700ns |  |  | unless $_[0]->{+FRAME};
25 |  |  |  |  |
26 | 3 | 2µs |  |  | $_[0]->{+DETAILS} = delete $_[0]->{detail} if $_[0]->{detail};
27 |  |  |  |  |
28 | 3 | 5µs |  |  | unless (defined($_[0]->{+PID}) || defined($_[0]->{+TID}) || defined($_[0]->{+CID})) {
29 | 2 | 2µs |  |  | $_[0]->{+PID} = $$ unless defined $_[0]->{+PID};
30 | 2 | 900ns |  |  | $_[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 {
35 | 1 | 400ns |  |  | my ($orig, @override) = @_;
36 | 1 | 3µs |  |  | bless {%$orig, @override}, __PACKAGE__;
37 |  |  |  |  | }
38 |  |  |  |  |
39 |  |  |  |  | sub 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 |  |  |  |  |
53 |  |  |  |  | sub 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 |  |  |  |  |
60 |  |  |  |  | sub alert {
61 |  |  |  |  | my $self = shift;
62 |  |  |  |  | my ($msg) = @_;
63 |  |  |  |  | warn $msg . ' ' . $self->debug . ".\n";
64 |  |  |  |  | }
65 |  |  |  |  |
66 |  |  |  |  | sub throw {
67 |  |  |  |  | my $self = shift;
68 |  |  |  |  | my ($msg) = @_;
69 |  |  |  |  | die $msg . ' ' . $self->debug . ".\n";
70 |  |  |  |  | }
71 |  |  |  |  |
72 | 1 | 3µ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 |  |  |  |  |
74 |  |  |  |  | sub full_call { @{$_[0]->{+FULL_CALLER}} }
75 |  |  |  |  |
76 |  |  |  |  | sub package { $_[0]->{+FRAME}->[0] }
77 |  |  |  |  | sub file { $_[0]->{+FRAME}->[1] }
78 |  |  |  |  | sub line { $_[0]->{+FRAME}->[2] }
79 |  |  |  |  | sub subname { $_[0]->{+FRAME}->[3] }
80 |  |  |  |  |
81 |  |  |  |  | sub warning_bits { $_[0]->{+FULL_CALLER} ? $_[0]->{+FULL_CALLER}->[9] : undef }
82 |  |  |  |  |
83 | 1 | 3µs |  |  | 1;
84 |  |  |  |  |
85 |  |  |  |  | __END__