File Coverage

blib/lib/IBM/StorageSystem/Statistic/Node/Memory.pm
Criterion Covered Total %
statement 12 23 52.1
branch 0 2 0.0
condition n/a
subroutine 4 14 28.5
pod 0 1 0.0
total 16 40 40.0


line stmt bran cond sub pod time code
1             package IBM::StorageSystem::Statistic::Node::Memory;
2              
3 1     1   6 use strict;
  1         2  
  1         26  
4 1     1   5 use warnings;
  1         3  
  1         23  
5              
6 1     1   5 use Carp qw(croak);
  1         2  
  1         78  
7              
8             our @ATTR = qw(start_time end_time avg_memory avg_cache_memory avg_swap_memory avg_swap_free_memory avg_free_memory avg_buffer_memory avg_dirty_memory avg_swap_cache_memory);
9              
10             foreach my $attr ( @ATTR ) {
11             {
12 1     1   4 no strict 'refs';
  1         2  
  1         189  
13             *{ __PACKAGE__ .'::'. $attr } = sub {
14 0     0     my( $self, $val ) = @_;
        0      
        0      
        0      
        0      
        0      
        0      
        0      
15 0 0         $self->{$attr} = $val if $val;
16 0           return $self->{$attr}
17             }
18             }
19             }
20              
21             sub new {
22 0     0 0   my( $class, @vals ) = @_;
23 0           my $self = bless {}, $class;
24 0           my $c = 0;
25              
26 0           foreach my $attr ( @ATTR ) { $self->{$attr} = $vals[$c]; $c++ }
  0            
  0            
27              
28 0           return $self
29             }
30              
31 0     0     sub _values { return @ATTR }
32              
33             1;
34              
35             __END__