mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-23 05:07:54 +00:00
parallel: Adjust length to read to make --block more predictable.
This commit is contained in:
parent
e4e88de3cb
commit
cfc8501693
|
@ -226,6 +226,8 @@ New in this release:
|
|||
|
||||
* Due to widely spread distributions still using --tollef even after a year of being retired following a year of being obsolete, --tollef now gives an error unless used with --gnu.
|
||||
|
||||
* Cookie 2013-08-18 was won by Mark Maimone, 1 year and 11 months after release.
|
||||
|
||||
* A parser for GNU Parallel --joblog files: https://github.com/harryjubb/joblog
|
||||
|
||||
* <<Har angiveligt submittet ny version - afventer opdatering>> GNU Parallel was used (unfortunately without citation) in: MUGBAS: a species free gene-based programme suite for post-GWAS analysis http://www.ncbi.nlm.nih.gov/pubmed/25765345
|
||||
|
|
11
src/parallel
11
src/parallel
|
@ -318,7 +318,11 @@ sub spreadstdin {
|
|||
my $header = find_header(\$buf,$in);
|
||||
while(1) {
|
||||
my $anything_written = 0;
|
||||
if(not read($in,substr($buf,length $buf,0),$blocksize)) {
|
||||
my $buflen = length $buf;
|
||||
my $readsize = ($buflen < $blocksize) ? $blocksize-$buflen : $blocksize;
|
||||
# If $buf < $blocksize, append so it is $blocksize long after reading.
|
||||
# Otherwise append a full $blocksize
|
||||
if(not read($in,substr($buf,$buflen,0),$readsize)) {
|
||||
# End-of-file
|
||||
$chunk_number != 1 and last;
|
||||
# Force the while-loop once if everything was read by header reading
|
||||
|
@ -472,7 +476,6 @@ sub nindex {
|
|||
# the position where the Nth copy is found
|
||||
my ($buf_ref, $str, $n) = @_;
|
||||
my $i = 0;
|
||||
my $two_gb = 2**31-1;
|
||||
for(1..$n) {
|
||||
$i = index64($buf_ref,$str,$i+1);
|
||||
if($i == -1) { last }
|
||||
|
@ -6144,7 +6147,7 @@ sub non_block_write {
|
|||
} else {
|
||||
# successfully wrote everything
|
||||
my $a = "";
|
||||
$self->set_stdin_buffer(\$a,\$a,"","");
|
||||
$self->set_stdin_buffer(\$a,\$a,0,"","");
|
||||
$something_written = $rv;
|
||||
}
|
||||
}
|
||||
|
@ -6189,7 +6192,7 @@ sub set_starttime {
|
|||
|
||||
sub runtime {
|
||||
# Returns:
|
||||
# Run time in seconds
|
||||
# Run time in seconds with 3 decimals
|
||||
my $self = shift;
|
||||
return sprintf("%.3f",int(($self->endtime() - $self->starttime())*1000)/1000);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue