diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-08-01 12:59:11 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-08-01 12:59:06 +0100 |
commit | c5405f732410fe851b8d4c73365336ec2490358b (patch) | |
tree | 13bf2a0478a54f4f86f596f1fefdf57587cd3a3c /perf | |
parent | c4f4c5726194c9cd800e5d6d9a09c7d01a4dadd7 (diff) |
perf: Save/restore gstate across runs
Reset the cairo_t to the initial state so that subsequent tests are not
affected by earlier tests.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'perf')
-rw-r--r-- | perf/cairo-perf-micro.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/perf/cairo-perf-micro.c b/perf/cairo-perf-micro.c index 19374403..ee5269a9 100644 --- a/perf/cairo-perf-micro.c +++ b/perf/cairo-perf-micro.c @@ -203,7 +203,9 @@ cairo_perf_run (cairo_perf_t *perf, name, perf->target->name, _content_to_string (perf->target->content, 0), perf->size); + cairo_save (perf->cr); perf_func (perf->cr, perf->size, perf->size, 1); + cairo_restore (perf->cr); status = cairo_surface_write_to_png (cairo_get_target (perf->cr), filename); if (status) { fprintf (stderr, "Failed to generate output check '%s': %s\n", @@ -232,10 +234,14 @@ cairo_perf_run (cairo_perf_t *perf, if (similar) cairo_push_group_with_content (perf->cr, cairo_boilerplate_content (perf->target->content)); + else + cairo_save (perf->cr); perf_func (perf->cr, perf->size, perf->size, 1); loops = cairo_perf_calibrate (perf, perf_func); if (similar) cairo_pattern_destroy (cairo_pop_group (perf->cr)); + else + cairo_restore (perf->cr); low_std_dev_count = 0; for (i =0; i < perf->iterations; i++) { @@ -243,10 +249,13 @@ cairo_perf_run (cairo_perf_t *perf, if (similar) cairo_push_group_with_content (perf->cr, cairo_boilerplate_content (perf->target->content)); + else + cairo_save (perf->cr); times[i] = perf_func (perf->cr, perf->size, perf->size, loops) / loops; if (similar) cairo_pattern_destroy (cairo_pop_group (perf->cr)); - + else + cairo_restore (perf->cr); if (perf->raw) { if (i == 0) printf ("[*] %s.%s %s.%d %g", |