blib/lib/Linux/GetPidstat/Writer/File.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 2 totaltotal 94.2% 33 / 35 CC 2 SCAR 2.2
CC
2
Cov
100%
output
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/Linux/GetPidstat/Collector.pm ↑ Summary Build »
1 package Linux::GetPidstat::Writer::File;
2 15 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 15 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 15 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 15 ▶use Path::Tiny qw/path/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 15 ▶use IO::Handle;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 sub new {
10 24 ▶ my ( $class, %opt ) = @_;
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
11  
12 24 $opt{file} = path($opt{res_file});
13 23 bless \%opt, $class;
14 }
15  
16 sub output {
17 362 ▶ my ($self, $program_name, $metric_name, $metric) = @_;
Subroutine output: called CC=2 SCAR=6.9
Pod undocumented
18  
19 my $msg = join ",", $self->{now}->datetime, $self->{now}->epoch,
20 362 $program_name, $metric_name, $metric;
21  
22 362 ▶ if ($self->{dry_run}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"dry_run"}) 145 217 362
23 145 print "(dry_run) file write: $msg\n";
24 145 return;
25 }
26  
27 217 $self->{file}->append("$msg\n");
28 }
29  
30 15 1;
31 __END__
« blib/lib/Linux/GetPidstat/Collector.pm ↑ Summary Build »