Thanks for the fix Ilya. Acked-by: Mark Michelson <[email protected]>
On 12/18/18 11:38 AM, Ilya Maximets wrote:
Current version is broken because it converts first argument to integer and after that substracts the duoble value. At the end the result converted to integer again. This does not cause unit test failures because qsort on linux accidentially makes right order. On FreeBSD this leads to the test failure: TEST '10-intervals-linear-growth' Assertion \ '|(&stats)->pctl_95 - (&d->expected_stats)->pctl_95| < 1e-1' failed: |9 - 10| < 0.1 CC: Mark Michelson <[email protected]> Fixes: aed45befeff2 ("Add stopwatch timing API") Signed-off-by: Ilya Maximets <[email protected]> --- lib/stopwatch.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/stopwatch.c b/lib/stopwatch.c index 2e69d8189..b8b31da67 100644 --- a/lib/stopwatch.c +++ b/lib/stopwatch.c @@ -104,7 +104,13 @@ comp_samples(const void *left, const void *right) const double *left_d = left; const double *right_d = right;- return (int) *right_d - *left_d;+ if (*right_d > *left_d) { + return -1; + } + if (*right_d < *left_d) { + return 1; + } + return 0; }/* Calculate the percentile using the P-square algorithm. For more
_______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
