← Index
NYTProf Performance Profile   « block view • line view • sub view »
For xt/tapper-mcp-scheduler-with-db-longrun.t
  Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:24:08 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Test/Deep/Cache/Simple.pm
StatementsExecuted 15 statements in 373µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11114µs16µsTest::Deep::Cache::::BEGIN@1 Test::Deep::Cache::BEGIN@1
1119µs33µsTest::Deep::Cache::Simple::::BEGIN@7Test::Deep::Cache::Simple::BEGIN@7
1118µs28µsTest::Deep::Cache::Simple::::BEGIN@5Test::Deep::Cache::Simple::BEGIN@5
1117µs26µsTest::Deep::Cache::Simple::::BEGIN@10Test::Deep::Cache::Simple::BEGIN@10
1116µs14µsTest::Deep::Cache::::BEGIN@2 Test::Deep::Cache::BEGIN@2
0000s0sTest::Deep::Cache::Simple::::__ANON__[:15]Test::Deep::Cache::Simple::__ANON__[:15]
0000s0sTest::Deep::Cache::Simple::::absorbTest::Deep::Cache::Simple::absorb
0000s0sTest::Deep::Cache::Simple::::addTest::Deep::Cache::Simple::add
0000s0sTest::Deep::Cache::Simple::::cmpTest::Deep::Cache::Simple::cmp
0000s0sTest::Deep::Cache::Simple::::fn_get_keyTest::Deep::Cache::Simple::fn_get_key
0000s0sTest::Deep::Cache::Simple::::newTest::Deep::Cache::Simple::new
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1318µs218µs
# spent 16µs (14+2) within Test::Deep::Cache::BEGIN@1 which was called: # once (14µs+2µs) by Test::Deep::Cache::BEGIN@6 at line 1
use strict;
# spent 16µs making 1 call to Test::Deep::Cache::BEGIN@1 # spent 2µs making 1 call to strict::import
2330µs221µs
# spent 14µs (6+7) within Test::Deep::Cache::BEGIN@2 which was called: # once (6µs+7µs) by Test::Deep::Cache::BEGIN@6 at line 2
use warnings;
# spent 14µs making 1 call to Test::Deep::Cache::BEGIN@2 # spent 7µs making 1 call to warnings::import
3
4package Test::Deep::Cache::Simple;
5319µs248µs
# spent 28µs (8+20) within Test::Deep::Cache::Simple::BEGIN@5 which was called: # once (8µs+20µs) by Test::Deep::Cache::BEGIN@6 at line 5
use Carp qw( confess );
# spent 28µs making 1 call to Test::Deep::Cache::Simple::BEGIN@5 # spent 20µs making 1 call to Exporter::import
6
7385µs258µs
# spent 33µs (9+24) within Test::Deep::Cache::Simple::BEGIN@7 which was called: # once (9µs+24µs) by Test::Deep::Cache::BEGIN@6 at line 7
use Scalar::Util qw( refaddr );
# spent 33µs making 1 call to Test::Deep::Cache::Simple::BEGIN@7 # spent 24µs making 1 call to Exporter::import
8
9BEGIN
10
# spent 26µs (7+19) within Test::Deep::Cache::Simple::BEGIN@10 which was called: # once (7µs+19µs) by Test::Deep::Cache::BEGIN@6 at line 21
{
1113µs if (grep /^weaken$/, @Scalar::Util::EXPORT_FAIL)
12 {
13 # we're running on a version of perl that has no weak refs, so we
14 # just install a no-op sub for weaken instead of importing it
15 *weaken = sub {};
16 }
17 else
18 {
1911µs119µs Scalar::Util->import('weaken');
# spent 19µs making 1 call to Exporter::import
20 }
211214µs126µs}
# spent 26µs making 1 call to Test::Deep::Cache::Simple::BEGIN@10
22
23sub new
24{
25 my $pkg = shift;
26
27 my $self = bless {}, $pkg;
28
29 return $self;
30}
31
32sub add
33{
34 my $self = shift;
35
36 my ($d1, $d2) = @_;
37 {
38 local $SIG{__DIE__};
39
40 # cannot weaken read only refs, no harm if we can't as they never
41 # disappear
42 eval{weaken($d1)};
43 eval{weaken($d2)};
44 }
45
46 $self->{fn_get_key(@_)} = [$d1, $d2];
47}
48
49sub cmp
50{
51 my $self = shift;
52
53 my $key = fn_get_key(@_);
54 my $pair = $self->{$key};
55
56 # are both weakened refs still valid, if not delete this entry
57 if (ref($pair->[0]) and ref($pair->[1]))
58 {
59 return 1;
60 }
61 else
62 {
63 delete $self->{$key};
64 return 0;
65 }
66}
67
68sub absorb
69{
70 my $self = shift;
71
72 my $other = shift;
73
74 @{$self}{keys %$other} = values %$other;
75}
76
77sub fn_get_key
78{
79 return join(",", sort (map {refaddr($_)} @_));
80}
8112µs1;