[cairo-perf-diff-files] Check for terminator before comparing tests.

Only the name of the terminating test is set so check that the current
test is not the terminator before comparing.
This commit is contained in:
Chris Wilson 2007-10-23 12:57:26 +01:00
parent e3248a2184
commit 38c779e7d6

View file

@ -608,7 +608,7 @@ cairo_perf_reports_compare (cairo_perf_report_t *reports,
int num_diffs, max_diffs;
double max_change;
double test_time;
cairo_bool_t seen_non_null;
int seen_non_null;
cairo_bool_t printed_speedup = FALSE;
cairo_bool_t printed_slowdown = FALSE;
@ -636,25 +636,31 @@ cairo_perf_reports_compare (cairo_perf_report_t *reports,
while (tests[i]->name && tests[i]->stats.iterations == 0)
tests[i]++;
if (tests[i]->name)
seen_non_null = 1;
seen_non_null++;
}
if (! seen_non_null)
if (seen_non_null < 2)
break;
/* Find the minimum of all current tests, (we have to do this
* in case some reports don't have a particular test). */
min_test = tests[0];
for (i = 1; i < num_reports; i++)
if (test_report_cmp_backend_then_name (tests[i], min_test) < 0)
for (i = 1; i < num_reports; i++) {
if (tests[i]->name &&
test_report_cmp_backend_then_name (tests[i], min_test) < 0)
{
min_test = tests[i];
}
}
/* For each report that has the current test, record it into
* the diff structure. */
diff->num_tests = 0;
diff->tests = xmalloc (num_reports * sizeof (test_diff_t));
for (i = 0; i < num_reports; i++) {
if (test_report_cmp_backend_then_name (tests[i], min_test) == 0) {
if (tests[i]->name &&
test_report_cmp_backend_then_name (tests[i], min_test) == 0)
{
test_time = tests[i]->stats.min_ticks;
if (options->use_ms)
test_time /= tests[i]->stats.ticks_per_ms;
@ -696,6 +702,8 @@ cairo_perf_reports_compare (cairo_perf_report_t *reports,
diff++;
num_diffs++;
}
if (num_diffs < 2)
goto DONE;
if (num_reports == 2)
qsort (diffs, num_diffs, sizeof (test_diff_t),
@ -709,7 +717,7 @@ cairo_perf_reports_compare (cairo_perf_report_t *reports,
max_change = fabs (diffs[i].change);
}
if (num_reports == 2 )
if (num_reports == 2)
printf ("old: %s\n"
"new: %s\n",
diffs->tests[0]->configuration,
@ -741,6 +749,7 @@ cairo_perf_reports_compare (cairo_perf_report_t *reports,
}
}
DONE:
for (i = 0; i < num_diffs; i++)
free (diffs[i].tests);
free (diffs);