]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Low pop statistics are not good.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 6 Feb 2008 13:34:59 +0000 (13:34 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 6 Feb 2008 13:34:59 +0000 (13:34 +0000)
git-svn-id: file:///svn/unbound/trunk@926 be551aaa-1e26-0410-a405-d3ace91eadb9

util/timehist.c

index d60a6d997e64d64a5153ec4fcb51b0ae69259b53..48f3a0d4e2021e92ae02cf499191699f4d30bb42 100644 (file)
@@ -198,7 +198,10 @@ timehist_quartile(struct timehist* hist, double q)
        if(!hist || hist->num == 0)
                return 0.;
        /* look for i'th element, interpolated */
-       lookfor = (double)timehist_count(hist) * q;
+       lookfor = (double)timehist_count(hist);
+       if(lookfor < 4)
+               return 0.; /* not enough elements for a good estimate */
+       lookfor *= q;
        passed = 0;
        i = 0;
        while(i+1 < hist->num &&