diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-02-06 20:11:17 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-02-13 13:26:53 +0000 |
commit | 655f6987334b991763a5ab7746dbfd73c6b05f3e (patch) | |
tree | 3b9dba6b70492046eb0d812870e4202033cf4e04 /perf/cairo-perf.c | |
parent | 798581a1b5a8a56ce9d16c5b21eab82851061732 (diff) | |
download | cairo-655f6987334b991763a5ab7746dbfd73c6b05f3e.tar.gz |
[perf] Split can_run? into a separate precondition.
Allow tests to skip unnecessary setup when pruning the list of perf cases.
Diffstat (limited to 'perf/cairo-perf.c')
-rw-r--r-- | perf/cairo-perf.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c index ad7da0aff..efe6e8d35 100644 --- a/perf/cairo-perf.c +++ b/perf/cairo-perf.c @@ -141,6 +141,22 @@ cairo_perf_has_similar (cairo_perf_t *perf) return TRUE; } +cairo_bool_t +cairo_perf_can_run (cairo_perf_t *perf, + const char *name) +{ + unsigned int i; + + if (perf->num_names == 0) + return TRUE; + + for (i = 0; i < perf->num_names; i++) + if (strstr (name, perf->names[i])) + return TRUE; + + return FALSE; +} + void cairo_perf_run (cairo_perf_t *perf, const char *name, @@ -152,14 +168,6 @@ cairo_perf_run (cairo_perf_t *perf, cairo_stats_t stats = {0.0, 0.0}; int low_std_dev_count; - if (perf->num_names) { - for (i = 0; i < perf->num_names; i++) - if (strstr (name, perf->names[i])) - goto NAME_FOUND; - return; - } - NAME_FOUND: - if (perf->list_only) { printf ("%s\n", name); return; |