line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Brackup::Chunker::Default; |
2
|
13
|
|
|
13
|
|
78
|
use strict; |
|
13
|
|
|
|
|
32
|
|
|
13
|
|
|
|
|
4503
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
sub chunks { |
5
|
90
|
|
|
90
|
0
|
439
|
my ($class, $file) = @_; |
6
|
90
|
|
|
|
|
196
|
my @chunk_list; |
7
|
|
|
|
|
|
|
|
8
|
90
|
|
|
|
|
402
|
my $root = $file->root; |
9
|
90
|
|
|
|
|
1222
|
my $chunk_size = $root->chunk_size; |
10
|
90
|
|
|
|
|
1244
|
my $size = $file->size; |
11
|
|
|
|
|
|
|
|
12
|
90
|
|
|
|
|
901
|
my $offset = 0; |
13
|
90
|
|
|
|
|
392
|
while ($offset < $size) { |
14
|
108
|
|
|
|
|
771
|
my $len = _min($chunk_size, $size - $offset); |
15
|
108
|
|
|
|
|
2341
|
my $chunk = Brackup::PositionedChunk->new( |
16
|
|
|
|
|
|
|
file => $file, |
17
|
|
|
|
|
|
|
offset => $offset, |
18
|
|
|
|
|
|
|
length => $len, |
19
|
|
|
|
|
|
|
); |
20
|
108
|
|
|
|
|
371
|
push @chunk_list, $chunk; |
21
|
108
|
|
|
|
|
472
|
$offset += $len; |
22
|
|
|
|
|
|
|
} |
23
|
90
|
|
|
|
|
778
|
return @chunk_list; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _min { |
27
|
108
|
|
|
108
|
|
1384
|
return (sort { $a <=> $b } @_)[0]; |
|
108
|
|
|
|
|
1507
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |