perf: Make cairo_t* available to perf functions

This commit is contained in:
Carl Worth 2006-10-04 13:23:50 -07:00
parent 4406ab1b9e
commit d0aae4dbcf
5 changed files with 20 additions and 21 deletions

View file

@ -40,29 +40,28 @@ Here is the basic structure of a performance test file:
static cairo_perf_ticks_t
do_my_new_test (cairo_t *cr, int width, int height)
{
cairo_perf_timer_start ();
/* Make the cairo calls to be measured */
cairo_perf_timer_stop ();
return cairo_perf_timer_elapsed ();
}
void
my_new_test (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
/* First do any setup for which the execution time should not
* be measured. For example, this might include loading
* images from disk, creating patterns, etc. */
cairo_perf_timer_start ();
/* Now make the real cairo calls to be measured */
cairo_perf_timer_stop ();
/* Finally, any cleanup */
/* Then return the time that elapsed. */
return cairo_perf_timer_elapsed ();
}
void
my_new_test (cairo_perf_t *perf)
{
/* Then launch the actual performance testing. */
cairo_perf_run (perf, "my_new_test", do_my_new_test);
}
/* Finally, perform any cleanup from the setup above. */
}
That's really all there is to writing a new test. The first function
above is the one that does the real work and returns a timing

View file

@ -223,7 +223,7 @@ main (int argc, char *argv[])
target->closure);
perf.cr = cairo_create (surface);
perf_case->run (&perf);
perf_case->run (&perf, perf.cr, perf.size, perf.size);
cairo_surface_destroy (surface);
}

View file

@ -69,7 +69,7 @@ cairo_perf_run (cairo_perf_t *perf,
const char *name,
cairo_perf_func_t perf_func);
#define CAIRO_PERF_DECL(func) void (func) (cairo_perf_t *perf);
#define CAIRO_PERF_DECL(func) void (func) (cairo_perf_t *perf, cairo_t *cr, int width, int height);
/* paint.c */
CAIRO_PERF_DECL (paint);

View file

@ -168,7 +168,7 @@ paint_source_surface_argb32 (cairo_t *cr, int width, int height)
}
void
paint (cairo_perf_t *perf)
paint (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
cairo_perf_run (perf, "paint_over_solid", paint_over_solid);
cairo_perf_run (perf, "paint_over_solid_alpha", paint_over_solid_alpha);

View file

@ -141,7 +141,7 @@ tessellate_256 (cairo_t *cr, int width, int height)
}
void
tessellate (cairo_perf_t *perf)
tessellate (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
cairo_perf_run (perf, "tessellate-16", tessellate_16);
cairo_perf_run (perf, "tessellate-64", tessellate_64);