diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-10-23 12:57:26 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2007-10-23 13:03:40 +0100 |
commit | 38c779e7d672151d25cd596149485fcc9f21c298 (patch) | |
tree | ff8469ac4ba4d0ac4ebe8b03a3516d9037e5b2a5 /perf | |
parent | e3248a21841cfcbc285d76e2299485f9822857f1 (diff) |
[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.
Diffstat (limited to 'perf')
-rw-r--r-- | perf/cairo-perf-diff-files.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/perf/cairo-perf-diff-files.c b/perf/cairo-perf-diff-files.c index 68283758..05e3fa3b 100644 --- a/perf/cairo-perf-diff-files.c +++ b/perf/cairo-perf-diff-files.c @@ -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); |