From 207f8dfabc8555e7adfa1e66fad14969f60e5e36 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Wed, 3 Aug 2011 11:54:55 +0200 Subject: [PATCH] parallel: --block support both base 2 and base 10: k=1000, K=1024, Ki=1024. --- src/parallel | 14 ++++++++++++++ src/parallel.pod | 9 +++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/parallel b/src/parallel index ea99c35e..ac8745a9 100755 --- a/src/parallel +++ b/src/parallel @@ -1741,8 +1741,22 @@ sub usleep { sub multiply_binary_prefix { # Evalualte numbers with binary prefix + # k=10^3, m=10^6, g=10^9, t=10^12, p=10^15, e=10^18, z=10^21, y=10^24 + # K=2^10, M=2^20, G=2^30, T=2^40, P=2^50, E=2^70, Z=2^80, Y=2^80 + # Ki=2^10, Mi=2^20, Gi=2^30, Ti=2^40, Pi=2^50, Ei=2^70, Zi=2^80, Yi=2^80 + # ki=2^10, mi=2^20, gi=2^30, ti=2^40, pi=2^50, ei=2^70, zi=2^80, yi=2^80 # 13G = 13*1024*1024*1024 = 13958643712 my $s = shift; + $s =~ s/k/*1000/g; + $s =~ s/M/*1000*1000/g; + $s =~ s/G/*1000*1000*1000/g; + $s =~ s/T/*1000*1000*1000*1000/g; + $s =~ s/P/*1000*1000*1000*1000*1000/g; + $s =~ s/E/*1000*1000*1000*1000*1000*1000/g; + $s =~ s/Z/*1000*1000*1000*1000*1000*1000*1000/g; + $s =~ s/Y/*1000*1000*1000*1000*1000*1000*1000*1000/g; + $s =~ s/X/*1000*1000*1000*1000*1000*1000*1000*1000*1000/g; + $s =~ s/Ki?/*1024/gi; $s =~ s/Mi?/*1024*1024/gi; $s =~ s/Gi?/*1024*1024*1024/gi; diff --git a/src/parallel.pod b/src/parallel.pod index b2347440..c5d90bdf 100644 --- a/src/parallel.pod +++ b/src/parallel.pod @@ -331,9 +331,10 @@ Implies B<--semaphore>. =item B<--block-size> I -Size of block in bytes. The size can be postfixed with K, M, G, T, or -P which would multiply the size with 1024, 1048576, 1073741824, -1099511627776 or 1125899906842624 respectively. +Size of block in bytes. The size can be postfixed with K, M, G, T, P, +k, m, g, t, or p which would multiply the size with 1024, 1048576, +1073741824, 1099511627776, 1125899906842624, 1000, 1000000, +1000000000, 1000000000000, or 1000000000000000 respectively. GNU B tries to meet the block size but can be off by the length of one record. @@ -799,7 +800,7 @@ B Implies B<-X> unless B<-m> or B<--pipe> is set. When used with B<--pipe> B<-N> is the number of records to read. This -is much slower than B<--blocksize> so avoid it if performance is +is much slower than B<--block> so avoid it if performance is important.