bench: fix nextN
authornsz <nsz@port70.net>
Thu, 28 Jul 2011 22:27:34 +0000 (00:27 +0200)
committernsz <nsz@port70.net>
Thu, 28 Jul 2011 22:27:34 +0000 (00:27 +0200)
common/bench.c

index 0436f67..b179bf8 100644 (file)
@@ -63,7 +63,11 @@ void reset_timer() {
 }
 
 static int nextN() {
-       unsigned long long n = 2*SEC/(ns/N + 1);
+       unsigned long long n = ns/N;
+       if (n == 0)
+               n = SEC;
+       else
+               n = SEC/n;
        if (n > N*100ULL)
                n = N*100ULL;
        else if (n <= N)