Greg Kim wrote:
Hi,

I was just looking at the Fetcher.java code on trunk (r 407599), snippet below.
The total # of bytes is getting multiplied by 8 and the division by
8.0 is missing;

 private void reportStatus() throws IOException {
   String status;
   synchronized (this) {
     long elapsed = (System.currentTimeMillis() - start)/1000;
     status =
       pages+" pages, "+errors+" errors, "
       + Math.round(((float)pages*10)/elapsed)/10.0+" pages/s, "
       + Math.round(((((float)bytes)*8)/1024)/elapsed)+" kb/s, ";
                                                     ^^^
   }
   reporter.setStatus(status);
 }

Funny you should mention that just now, I was looking at this calculation today - and if you take what is printed literally, it says the truth, because it converts bytes (apparently defined as octets) into bits (multiply by 8) and then to kilo-bits - although one could say that this is not strictly true either, it's rather kibibits - http://en.wikipedia.org/wiki/Kibibyte).

So, the calculation is correct, and the unit name "kb/s" correctly uses lower-case "b" to signify "bits" rather than "bytes", although many people tend to take this as bytes ...

--
Best regards,
Andrzej Bialecki     <><
___. ___ ___ ___ _ _   __________________________________
[__ || __|__/|__||\/|  Information Retrieval, Semantic Web
___|||__||  \|  ||  |  Embedded Unix, System Integration
http://www.sigram.com  Contact: info at sigram dot com


Reply via email to