tests: make test time output configurable with TIME_DIFF_THRESHOLD

setting this value too low will likely lead to unmanageable results

Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com>
This commit is contained in:
Mike Blumenkrantz 2018-03-26 14:41:09 -04:00 committed by Stefan Schmidt
parent adc601aca2
commit ff67706783
1 changed files with 17 additions and 1 deletions

View File

@ -153,11 +153,27 @@ EINA_UNUSED static void
_timing_end(void)
{
double diff;
static int thres_set = 0;
static double thres = 0;
if (!_timing_enabled()) return;
if (!thres_set)
{
const char *env = getenv("TIME_DIFF_THRESHOLD");
if (env)
{
thres = strtod(env, NULL);
if (thres > 0)
thres_set = 1;
}
if (!thres_set)
thres = 0.0001;
thres_set = 1;
}
diff = _timing_time_get() - _timing_start_time;
if (diff > 0.0001)
if (diff > thres)
printf("TIME %s: %.5g\n", tcase_name(), diff);
}