Re: [PATCH 1/2] strbuf: create strbuf_humanize() to show byte sizes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 10, 2013 at 9:43 PM, Jonathan Nieder <jrnieder@xxxxxxxxx> wrote:
> Antoine Pelisse wrote:
>>                    One of the drawbacks is that speed will now look like
>> this when download is stalled: "0 bytes/s" instead of "0 KiB/s".
>
> At first glance that is neither obviously a benefit nor obviously a
> drawback.  Can you spell this out more?

The drawback to me is that it changes the user experience with no reason.
But that's really a minor change, I agree. (maybe I should have put it
as a comment/question after ---)

>> --- a/Documentation/technical/api-strbuf.txt
>> +++ b/Documentation/technical/api-strbuf.txt
>> @@ -230,6 +230,11 @@ which can be used by the programmer of the callback as she sees fit.
>>       destination. This is useful for literal data to be fed to either
>>       strbuf_expand or to the *printf family of functions.
>>
>> +`strbuf_humanize`::
>> +
>> +     Append the given byte size as a human-readable string (i.e. 12.23 KiB,
>> +     3.50 MiB).
>
> Based on the function name alone, it is not easy to guess what it will
> do (e.g., maybe it will paraphrase 3 to "three" and 10000000 to
> "enormous").  How about something like strbuf_filesize?

I think the suggestion from Junio makes more sense, as it can be used
for download speed.

> If I understand the code correctly, this jumps units each time it
> exceeds 1.0 of the next unit (bytes, KiB, MiB, GiB), which sounds like
> a fine behavior.

The code has simply been extracted from the former function and kept unmodified.

Thanks for the help !
Antoine,
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]