[Toybox] [PATCH] count.c: Human readable -h option and MAYFORK

Rob Landley rob at landley.net
Tue Oct 17 02:37:19 PDT 2023


On 10/16/23 19:28, Oliver Webb wrote:
>> That said, a -l long output version that has the raw number, and the human
>> readable, and time, and recent/total rate, might be useful? (I'd prefer -l
>> instead of -v, but same general concept.)
> 
> I added a -l[ong] option in the below patch, It only shows the average rate, not recent

I was 2/3 through adding -l myself when I saw this. Credited you with the idea
in the checkin comment.

> While trying to do math with the time, 
> I noticed that 'then' was never set to anything after initialization to 0, 
> and 'now' is only used while setting it to millitime(). 

Indeed, that's part of the reason I started fiddling with it...

> Which means the check for "Have we already done this in the last 250ms?" might as well be 
> "if(millitime()<250) continue;". I fixed this by setting 'then' at the end of the for loop

Let me know if I screwed stuff up this time, I've been under the weather the
past few days...

Thanks,

Rob


More information about the Toybox mailing list