File Coverage

blib/lib/Dumbbench/Result.pm
Criterion Covered Total %
statement 32 33 96.9
branch 5 6 83.3
condition 4 9 44.4
subroutine 7 7 100.0
pod 1 1 100.0
total 49 56 87.5


line stmt bran cond sub pod time code
1             package Dumbbench::Result;
2 3     3   23 use strict;
  3         6  
  3         76  
3 3     3   14 use warnings;
  3         5  
  3         58  
4 3     3   14 use Carp ();
  3         8  
  3         50  
5              
6 3     3   1417 use Number::WithError;
  3         17728  
  3         165  
7 3     3   1184 use parent 'Number::WithError';
  3         634  
  3         14  
8              
9             use Class::XSAccessor {
10 3         27 getters => {
11             nsamples => '_dbr_nsamples',
12             },
13 3     3   167 };
  3         753  
14              
15              
16             sub new {
17 22     22 1 206 my $proto = shift;
18 22   66     76 my $class = ref($proto)||$proto;
19              
20 22         27 my $self;
21 22 100       51 if (not grep {$_ eq 'timing'} @_) {
  68         183  
22 12 100       32 push @_, 0 if @_ == 1;
23 12         30 $self = $proto->SUPER::new(@_);
24 12         262 $self->{_dbr_nsamples} = $proto->nsamples;
25 12         32 return $self;
26             }
27              
28 10         31 my %opt = @_;
29 10 50 33     58 if (not defined $opt{timing} or not defined $opt{uncertainty}
      33        
30             or not defined $opt{nsamples}) {
31 0         0 Carp::croak("Need 'timing', 'uncertainty', and 'nsamples' parameters");
32             }
33 10         38 $self = $class->SUPER::new($opt{timing}, $opt{uncertainty});
34 10         287 $self->{_dbr_nsamples} = $opt{nsamples};
35              
36 10         31 return $self;
37             }
38              
39              
40              
41              
42              
43             1;