[Toybox] [PATCH] count.c: Human readable -h option and MAYFORK
Rob Landley
rob at landley.net
Sat Oct 21 03:34:46 PDT 2023
On 10/20/23 01:05, Rob Landley wrote:
> P.S. Count's X/s time output is actually X/period and the period is 250ms, but
> it's also zeroing new periods and advancing into the zeroed period immediately
> in the calculation as a full period when we've only been there for less than a
> full 250ms, and what it SHOULD do is look at the remainder of millitime()%250
> and use that to add a fraction of the oldest period (not otherwise included, and
> not included as a period in the divisor) so "however much data the new one
> accumulated in less than a full period of time" plus "the reciprocal portion of
> the old period we left" should equal a coherent count.
After commit 2f93b89b62d1 it's now:
$ toybox timeout .1 ./yes | ./count -l >/dev/null
249135104 bytes, 238Mb, 2.3Gb/s, 0m00s
$ toybox timeout .2 ./yes | ./count -l >/dev/null
512294912 bytes, 489Mb, 2.3Gb/s, 0m00s
$ toybox timeout .6 ./yes | ./count -l >/dev/null
1665302528 bytes, 1.5Gb, 2.5Gb/s, 0m00s
$ toybox timeout 1 ./yes | ./count -l >/dev/null
2610102272 bytes, 2.4Gb, 2.4Gb/s, 0m01s
I had to explicitly use toybox timeout because debian's timeout doesn't seem to
actually call the child process for .2 seconds or less. No, I don't have a clear
idea how to add this to the test suite yet, but I'm calling it good enough for now.
Rob
More information about the Toybox
mailing list