File Coverage

blib/lib/Ref/Store/ThreadUtil.pm
Criterion Covered Total %
statement 31 47 65.9
branch n/a
condition n/a
subroutine 11 16 68.7
pod 0 4 0.0
total 42 67 62.6


line stmt bran cond sub pod time code
1             package Ref::Store::ThreadUtil::OldLookups;
2 1     1   5 use strict;
  1         2  
  1         29  
3 1     1   5 use warnings;
  1         1  
  1         28  
4 1     1   5 use Ref::Store::Common;
  1         2  
  1         178  
5              
6             my @Lookups;
7             BEGIN {
8 1     1   30 @Lookups = qw(forward reverse attr_lookup scalar_lookup);
9             }
10             use Class::XSAccessor::Array
11 1     1   1006 accessors => { %Ref::Store::Common::LookupNames };
  1         8161  
  1         17  
12              
13             sub new {
14 0     0     my ($cls,$old_table) = @_;
15 0           my %options = ();
16 0           my $self = [];
17 0           foreach my $idx (
18             HR_TIDX_RLOOKUP, HR_TIDX_FLOOKUP,
19             HR_TIDX_ALOOKUP, HR_TIDX_SLOOKUP) {
20 0           $self->[$idx] = { %{$old_table->[$idx]} };
  0            
21             }
22 0           bless $self, $cls;
23             }
24              
25             package Ref::Store::ThreadUtil;
26 1     1   1579 use strict;
  1         2  
  1         47  
27 1     1   5 use warnings;
  1         2  
  1         47  
28 1     1   6 use base qw(Exporter);
  1         8  
  1         110  
29             our @EXPORT;
30 1     1   6 use constant HR_THR_AENCAP_PREFIX => '__PP_AENCAP:';
  1         1  
  1         74  
31 1     1   5 use constant HR_THR_KENCAP_PREFIX => '__PP_KENCAP:';
  1         2  
  1         62  
32 1     1   5 use constant HR_THR_LINFO_PREFIX => '__PP_OLD_LOOKUPS:';
  1         2  
  1         281  
33              
34             push @EXPORT, qw(
35             HR_THR_AENCAP_PREFIX
36             HR_THR_KENCAP_PREFIX
37             HR_THR_LINFO_PREFIX
38             );
39              
40             sub hr_thrutil_store_linfo {
41 0     0 0   my ($old_table,$ptr_map) = @_;
42 0           my $linfo = Ref::Store::ThreadUtil::OldLookups->new($old_table);
43 0           $ptr_map->{ HR_THR_LINFO_PREFIX . ($old_table + 0) } = $linfo;
44             }
45              
46             sub hr_thrutil_get_linfo {
47 0     0 0   my ($old_taddr,$ptr_map) = @_;
48 0           return $ptr_map->{ HR_THR_LINFO_PREFIX . $old_taddr };
49             }
50              
51             push @EXPORT, qw(hr_thrutil_store_linfo hr_thrutil_get_linfo);
52              
53             sub hr_thrutil_store_kinfo {
54 0     0 0   my ($prefix,$k,$ptr_map,$info) = @_;
55 0           $ptr_map->{$prefix . $k} = $info;
56             }
57              
58             sub hr_thrutil_get_kinfo {
59 0     0 0   my ($prefix,$k,$ptr_map) = @_;
60 0           $ptr_map->{$prefix.$k};
61             }
62              
63             push @EXPORT, qw(hr_thrutil_store_kinfo hr_thrutil_get_kinfo);
64