From db083499bfff8aee794512e3da2f0ad2f201f6b0 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 7 Mar 2017 11:35:03 +0000 Subject: timerate: don't calculate threshold by too few iterations, because sometimes first iteration(s) can be too fast (cached, delayed clean up, etc). --- generic/tclCmdMZ.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 14ff5f0..b62ccf8 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -4282,6 +4282,13 @@ usage: if (middle >= stop) { break; } + + /* don't calculate threshold by few iterations, because sometimes + * first iteration(s) can be too fast (cached, delayed clean up, etc) */ + if (count < 10) { + threshold = 1; continue; + } + /* average iteration time in microsecs */ threshold = (middle - start) / count; if (threshold > maxIterTm) { -- cgit v0.12