mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 07:38:22 +02:00
[perf] Split can_run? into a separate precondition.
Allow tests to skip unnecessary setup when pruning the list of perf cases.
This commit is contained in:
parent
798581a1b5
commit
655f698733
25 changed files with 89 additions and 8 deletions
|
|
@ -88,6 +88,9 @@ box_outline_fill (cairo_t *cr, int width, int height)
|
|||
void
|
||||
box_outline (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "box-outline"))
|
||||
return;
|
||||
|
||||
cairo_perf_run (perf, "box-outline-stroke", box_outline_stroke);
|
||||
cairo_perf_run (perf, "box-outline-fill", box_outline_fill);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -89,6 +89,10 @@ typedef struct _cairo_perf {
|
|||
typedef cairo_perf_ticks_t
|
||||
(*cairo_perf_func_t) (cairo_t *cr, int width, int height);
|
||||
|
||||
cairo_bool_t
|
||||
cairo_perf_can_run (cairo_perf_t *perf,
|
||||
const char *name);
|
||||
|
||||
void
|
||||
cairo_perf_run (cairo_perf_t *perf,
|
||||
const char *name,
|
||||
|
|
|
|||
|
|
@ -81,6 +81,9 @@ composite_checker (cairo_perf_t *perf,
|
|||
{
|
||||
cairo_surface_t *image;
|
||||
|
||||
if (! cairo_perf_can_run (perf, "composite-checker"))
|
||||
return;
|
||||
|
||||
/* Create the checker pattern. We don't actually need to draw
|
||||
* anything on it since that wouldn't affect performance.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -201,6 +201,9 @@ do_dragon_solid (cairo_t *cr, int width, int height)
|
|||
void
|
||||
dragon (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "dragon"))
|
||||
return;
|
||||
|
||||
cairo_perf_run (perf, "dragon-solid", do_dragon_solid);
|
||||
cairo_perf_run (perf, "dragon", do_dragon);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,5 +45,8 @@ do_fill (cairo_t *cr, int width, int height)
|
|||
void
|
||||
fill (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "fill"))
|
||||
return;
|
||||
|
||||
cairo_perf_cover_sources_and_operators (perf, "fill", do_fill);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,6 +92,9 @@ random_nz (cairo_t *cr, int width, int height)
|
|||
void
|
||||
intersections (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "intersections"))
|
||||
return;
|
||||
|
||||
cairo_perf_run (perf, "intersections-nz-fill", random_nz);
|
||||
cairo_perf_run (perf, "intersections-eo-fill", random_eo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,5 +63,8 @@ do_long_dashed_lines (cairo_t *cr, int width, int height)
|
|||
void
|
||||
long_dashed_lines (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "long-dashed-lines"))
|
||||
return;
|
||||
|
||||
cairo_perf_run (perf, "long-dashed-lines", do_long_dashed_lines);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,6 +112,9 @@ long_lines_cropped (cairo_t *cr, int width, int height)
|
|||
void
|
||||
long_lines (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "long-lines"))
|
||||
return;
|
||||
|
||||
cairo_perf_run (perf, "long-lines-uncropped", long_lines_uncropped);
|
||||
cairo_perf_run (perf, "long-lines-cropped", long_lines_cropped);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,6 +161,9 @@ mosaic_tessellate_curves (cairo_t *cr, int width, int height)
|
|||
void
|
||||
mosaic (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "mosaic"))
|
||||
return;
|
||||
|
||||
cairo_perf_run (perf, "mosaic_fill_curves", mosaic_fill_curves);
|
||||
cairo_perf_run (perf, "mosaic_fill_lines", mosaic_fill_lines);
|
||||
cairo_perf_run (perf, "mosaic_tessellate_curves", mosaic_tessellate_curves);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ do_paint_with_alpha (cairo_t *cr, int width, int height)
|
|||
void
|
||||
paint_with_alpha (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "paint-with-alpha"))
|
||||
return;
|
||||
|
||||
cairo_perf_cover_sources_and_operators (perf, "paint-with-alpha",
|
||||
do_paint_with_alpha);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,8 @@ do_paint (cairo_t *cr, int width, int height)
|
|||
void
|
||||
paint (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "paint"))
|
||||
return;
|
||||
|
||||
cairo_perf_cover_sources_and_operators (perf, "paint", do_paint);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,9 @@ pattern_create_radial (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (! cairo_perf_can_run (perf, "pattern_create_radial"))
|
||||
return;
|
||||
|
||||
srand (time (0));
|
||||
for (i = 0; i < RADIALS_COUNT; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -82,5 +82,8 @@ do_pythagoras_tree (cairo_t *cr, int width, int height)
|
|||
void
|
||||
pythagoras_tree (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "pythagoras_tree"))
|
||||
return;
|
||||
|
||||
cairo_perf_run (perf, "pythagoras_tree", do_pythagoras_tree);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,9 @@ rectangles (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (! cairo_perf_can_run (perf, "rectangles"))
|
||||
return;
|
||||
|
||||
srand (8478232);
|
||||
for (i = 0; i < RECTANGLE_COUNT; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -98,6 +98,9 @@ rounded_rectangles (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (! cairo_perf_can_run (perf, "rounded-rectangles"))
|
||||
return;
|
||||
|
||||
srand (8478232);
|
||||
for (i = 0; i < RECTANGLE_COUNT; i++) {
|
||||
rects[i].x = rand () % width;
|
||||
|
|
|
|||
|
|
@ -189,6 +189,9 @@ draw_spiral_nz_na_di (cairo_t *cr, int width, int height)
|
|||
void
|
||||
spiral (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "spiral"))
|
||||
return;
|
||||
|
||||
cairo_perf_run (perf, "spiral-diag-nonalign-evenodd-fill", draw_spiral_eo_na_di);
|
||||
cairo_perf_run (perf, "spiral-diag-nonalign-nonzero-fill", draw_spiral_nz_na_di);
|
||||
cairo_perf_run (perf, "spiral-diag-pixalign-evenodd-fill", draw_spiral_eo_pa_di);
|
||||
|
|
|
|||
|
|
@ -47,5 +47,8 @@ do_stroke (cairo_t *cr, int width, int height)
|
|||
void
|
||||
stroke (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "stroke"))
|
||||
return;
|
||||
|
||||
cairo_perf_cover_sources_and_operators (perf, "stroke", do_stroke);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ subimage_copy (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
|||
cairo_surface_t *image;
|
||||
cairo_t *cr2;
|
||||
|
||||
if (! cairo_perf_can_run (perf, "subimage_copy"))
|
||||
return;
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 1); /* blue */
|
||||
cairo_paint (cr);
|
||||
|
||||
|
|
|
|||
|
|
@ -143,6 +143,9 @@ tessellate_256 (cairo_t *cr, int width, int height)
|
|||
void
|
||||
tessellate (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "tessellate"))
|
||||
return;
|
||||
|
||||
cairo_perf_run (perf, "tessellate-16", tessellate_16);
|
||||
cairo_perf_run (perf, "tessellate-64", tessellate_64);
|
||||
cairo_perf_run (perf, "tessellate-256", tessellate_256);
|
||||
|
|
|
|||
|
|
@ -56,5 +56,8 @@ do_text (cairo_t *cr, int width, int height)
|
|||
void
|
||||
text (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "text"))
|
||||
return;
|
||||
|
||||
cairo_perf_cover_sources_and_operators (perf, "text", do_text);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,5 +46,8 @@ twin (cairo_perf_t *perf,
|
|||
int width,
|
||||
int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "twin"))
|
||||
return;
|
||||
|
||||
cairo_perf_run (perf, "twin", do_twin);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,5 +59,8 @@ do_unaligned_clip (cairo_t *cr, int width, int height)
|
|||
void
|
||||
unaligned_clip (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "unaligned-clip"))
|
||||
return;
|
||||
|
||||
cairo_perf_run (perf, "unaligned_clip", do_unaligned_clip);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,5 +105,8 @@ do_world_map (cairo_t *cr, int width, int height)
|
|||
void
|
||||
world_map (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "world_map"))
|
||||
return;
|
||||
|
||||
cairo_perf_run (perf, "world_map", do_world_map);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,6 +85,9 @@ zrusin_another_fill (cairo_t *cr, int width, int height)
|
|||
void
|
||||
zrusin (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
||||
{
|
||||
if (! cairo_perf_can_run (perf, "zrusin"))
|
||||
return;
|
||||
|
||||
cairo_perf_run (perf, "zrusin_another_tessellate", zrusin_another_tessellate);
|
||||
cairo_perf_run (perf, "zrusin_another_fill", zrusin_another_fill);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue