line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Linux::GetPidstat::Writer::File; |
2
|
15
|
|
|
15
|
|
100036
|
use 5.008001; |
|
15
|
|
|
|
|
33
|
|
3
|
15
|
|
|
15
|
|
61
|
use strict; |
|
15
|
|
|
|
|
18
|
|
|
15
|
|
|
|
|
311
|
|
4
|
15
|
|
|
15
|
|
59
|
use warnings; |
|
15
|
|
|
|
|
29
|
|
|
15
|
|
|
|
|
326
|
|
5
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
71
|
use Path::Tiny qw/path/; |
|
15
|
|
|
|
|
51
|
|
|
15
|
|
|
|
|
615
|
|
7
|
15
|
|
|
15
|
|
75
|
use IO::Handle; |
|
15
|
|
|
|
|
23
|
|
|
15
|
|
|
|
|
2258
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
24
|
|
|
24
|
0
|
4216
|
my ( $class, %opt ) = @_; |
11
|
|
|
|
|
|
|
|
12
|
24
|
|
|
|
|
128
|
$opt{file} = path($opt{res_file}); |
13
|
23
|
|
|
|
|
1317
|
bless \%opt, $class; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub output { |
17
|
362
|
|
|
362
|
0
|
1448
|
my ($self, $program_name, $metric_name, $metric) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $msg = join ",", $self->{now}->datetime, $self->{now}->epoch, |
20
|
362
|
|
|
|
|
1004
|
$program_name, $metric_name, $metric; |
21
|
|
|
|
|
|
|
|
22
|
362
|
100
|
|
|
|
11290
|
if ($self->{dry_run}) { |
23
|
145
|
|
|
|
|
1133
|
print "(dry_run) file write: $msg\n"; |
24
|
145
|
|
|
|
|
542
|
return; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
217
|
|
|
|
|
685
|
$self->{file}->append("$msg\n"); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
__END__ |