line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package NetApp::Snapshot::Delta; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '500.002'; |
5
|
|
|
|
|
|
|
$VERSION = eval $VERSION; ## no critic: StringyEval |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
54
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
9
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
86
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
6
|
use Class::Std; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
12
|
1
|
|
|
1
|
|
144
|
use Params::Validate qw( :all ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
937
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my %from_of :ATTR( get => 'from' ); |
17
|
|
|
|
|
|
|
my %to_of :ATTR( get => 'to' ); |
18
|
|
|
|
|
|
|
my %changed_of :ATTR( get => 'changed' ); |
19
|
|
|
|
|
|
|
my %time_of :ATTR( get => 'time' ); |
20
|
|
|
|
|
|
|
my %rate_of :ATTR( get => 'rate' ); |
21
|
|
|
|
|
|
|
my %summary_of :ATTR( get => 'summary' ); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub BUILD { |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
0
|
0
|
0
|
my ($self,$ident,$args_ref) = @_; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
0
|
my @args = %$args_ref; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
0
|
my (%args) = validate( @args, { |
30
|
|
|
|
|
|
|
from => { type => SCALAR }, |
31
|
|
|
|
|
|
|
to => { type => SCALAR }, |
32
|
|
|
|
|
|
|
changed => { type => SCALAR }, |
33
|
|
|
|
|
|
|
time => { type => SCALAR }, |
34
|
|
|
|
|
|
|
rate => { type => SCALAR }, |
35
|
|
|
|
|
|
|
summary => { type => SCALAR }, |
36
|
|
|
|
|
|
|
}); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
0
|
$from_of{$ident} = $args{from}; |
39
|
0
|
|
|
|
|
0
|
$to_of{$ident} = $args{to}; |
40
|
0
|
|
|
|
|
0
|
$changed_of{$ident} = $args{changed}; |
41
|
0
|
|
|
|
|
0
|
$time_of{$ident} = $args{time}; |
42
|
0
|
|
|
|
|
0
|
$rate_of{$ident} = $args{rate}; |
43
|
0
|
|
|
|
|
0
|
$summary_of{$ident} = $args{summary}; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub is_summary { |
48
|
0
|
|
|
0
|
1
|
0
|
return shift->get_summary; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _parse_snap_delta { |
54
|
|
|
|
|
|
|
|
55
|
3
|
|
|
3
|
|
4183
|
my $class = shift; |
56
|
3
|
|
|
|
|
6
|
my $line = shift; |
57
|
|
|
|
|
|
|
|
58
|
3
|
|
|
|
|
11
|
$line =~ s/Active File System/active/g; |
59
|
|
|
|
|
|
|
|
60
|
3
|
|
|
|
|
16
|
my @line = split /\s+/, $line; |
61
|
|
|
|
|
|
|
|
62
|
3
|
|
|
|
|
7
|
my $from = shift @line; |
63
|
3
|
|
|
|
|
4
|
my $to = shift @line; |
64
|
3
|
|
|
|
|
6
|
my $changed = shift @line; |
65
|
3
|
|
|
|
|
4
|
my $time = shift @line; |
66
|
3
|
|
|
|
|
8
|
my $next = shift @line; |
67
|
3
|
|
|
|
|
4
|
my $rate; |
68
|
|
|
|
|
|
|
|
69
|
3
|
100
|
|
|
|
15
|
if ( $next =~ /^\d{2}:\d{2}$/ ) { |
70
|
2
|
|
|
|
|
5
|
$time .= " $next"; |
71
|
2
|
|
|
|
|
5
|
$rate = shift @line; |
72
|
|
|
|
|
|
|
} else { |
73
|
1
|
|
|
|
|
3
|
$rate = $next; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
3
|
50
|
33
|
|
|
62
|
if ( @line || ! defined $from || ! defined $to || |
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
77
|
|
|
|
|
|
|
! defined $changed || ! defined $time || ! defined $rate ) { |
78
|
0
|
|
|
|
|
0
|
croak("Unable to parse snapshot delta: $line\n"); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
return { |
82
|
3
|
|
|
|
|
23
|
from => $from, |
83
|
|
|
|
|
|
|
to => $to, |
84
|
|
|
|
|
|
|
changed => $changed, |
85
|
|
|
|
|
|
|
time => $time, |
86
|
|
|
|
|
|
|
rate => $rate, |
87
|
|
|
|
|
|
|
}; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |