summaryrefslogtreecommitdiff
path: root/perf
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-08-22 18:59:01 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-08-29 08:08:26 +0100
commitbdd3c5ba6987280b455229dd12b20c22159ce61c (patch)
treec85172f26c5c1ced54731610930c7eeb630de5a6 /perf
parent77c11096169bc8af6aa08241a800a51a2292a27a (diff)
[perf] Match directory names
In order to handle 'cairo-perf-trace benchmark', we need to perform the can_run? test on the directory name as opposed to the individual trace names. Make it so.
Diffstat (limited to 'perf')
-rw-r--r--perf/box-outline.c2
-rw-r--r--perf/cairo-perf-trace.c37
-rw-r--r--perf/cairo-perf.c14
-rw-r--r--perf/cairo-perf.h3
-rw-r--r--perf/composite-checker.c2
-rw-r--r--perf/dragon.c3
-rw-r--r--perf/fill.c2
-rw-r--r--perf/glyphs.c2
-rw-r--r--perf/intersections.c2
-rw-r--r--perf/long-dashed-lines.c2
-rw-r--r--perf/long-lines.c2
-rw-r--r--perf/mask.c2
-rw-r--r--perf/mosaic.c2
-rw-r--r--perf/paint-with-alpha.c2
-rw-r--r--perf/paint.c2
-rw-r--r--perf/pattern_create_radial.c2
-rw-r--r--perf/pythagoras-tree.c4
-rw-r--r--perf/rectangles.c2
-rw-r--r--perf/rounded-rectangles.c2
-rw-r--r--perf/spiral.c2
-rw-r--r--perf/stroke.c2
-rw-r--r--perf/subimage_copy.c2
-rw-r--r--perf/tessellate.c2
-rw-r--r--perf/text.c2
-rw-r--r--perf/twin.c2
-rw-r--r--perf/unaligned-clip.c2
-rw-r--r--perf/world-map.c2
-rw-r--r--perf/zrusin.c2
28 files changed, 68 insertions, 39 deletions
diff --git a/perf/box-outline.c b/perf/box-outline.c
index 6b97b081..e216b79a 100644
--- a/perf/box-outline.c
+++ b/perf/box-outline.c
@@ -94,7 +94,7 @@ box_outline_fill (cairo_t *cr, int width, int height, int loops)
void
box_outline (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "box-outline"))
+ if (! cairo_perf_can_run (perf, "box-outline", NULL))
return;
cairo_perf_run (perf, "box-outline-stroke", box_outline_stroke);
diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c
index f594a28e..52e54294 100644
--- a/perf/cairo-perf-trace.c
+++ b/perf/cairo-perf-trace.c
@@ -124,14 +124,21 @@ target_is_measurable (const cairo_boilerplate_target_t *target)
cairo_bool_t
cairo_perf_can_run (cairo_perf_t *perf,
- const char *name)
+ const char *name,
+ cairo_bool_t *is_explicit)
{
unsigned int i;
char *copy, *dot;
cairo_bool_t ret;
- if (perf->exact_names)
+ if (is_explicit)
+ *is_explicit = FALSE;
+
+ if (perf->exact_names) {
+ if (is_explicit)
+ *is_explicit = TRUE;
return TRUE;
+ }
if (perf->num_names == 0 && perf->num_exclude_names == 0)
return TRUE;
@@ -144,8 +151,11 @@ cairo_perf_can_run (cairo_perf_t *perf,
if (perf->num_names) {
ret = TRUE;
for (i = 0; i < perf->num_names; i++)
- if (strstr (copy, perf->names[i]))
+ if (strstr (copy, perf->names[i])) {
+ if (is_explicit)
+ *is_explicit = strcmp (copy, perf->names[i]) == 0;
goto check_exclude;
+ }
ret = FALSE;
goto done;
@@ -155,8 +165,11 @@ check_exclude:
if (perf->num_exclude_names) {
ret = FALSE;
for (i = 0; i < perf->num_exclude_names; i++)
- if (strstr (copy, perf->exclude_names[i]))
+ if (strstr (copy, perf->exclude_names[i])) {
+ if (is_explicit)
+ *is_explicit = strcmp (copy, perf->exclude_names[i]) == 0;
goto done;
+ }
ret = TRUE;
goto done;
@@ -315,8 +328,8 @@ execute (cairo_perf_t *perf,
name);
fprintf (perf->summary,
"%#8.3f %#8.3f %#6.2f%% %4d/%d",
- stats.min_ticks / (double) cairo_perf_ticks_per_second (),
- stats.median_ticks / (double) cairo_perf_ticks_per_second (),
+ (double) stats.min_ticks / cairo_perf_ticks_per_second (),
+ (double) stats.median_ticks / cairo_perf_ticks_per_second (),
stats.std_dev * 100.0,
stats.iterations, i+1);
fflush (perf->summary);
@@ -335,8 +348,8 @@ execute (cairo_perf_t *perf,
}
fprintf (perf->summary,
"%#8.3f %#8.3f %#6.2f%% %4d/%d\n",
- stats.min_ticks / (double) cairo_perf_ticks_per_second (),
- stats.median_ticks / (double) cairo_perf_ticks_per_second (),
+ (double) stats.min_ticks / cairo_perf_ticks_per_second (),
+ (double) stats.median_ticks / cairo_perf_ticks_per_second (),
stats.std_dev * 100.0,
stats.iterations, i);
fflush (perf->summary);
@@ -623,11 +636,17 @@ cairo_perf_trace_dir (cairo_perf_t *perf,
DIR *dir;
struct dirent *de;
int num_traces = 0;
+ cairo_bool_t force;
+ cairo_bool_t is_explicit;
dir = opendir (dirname);
if (dir == NULL)
return 0;
+ force = FALSE;
+ if (cairo_perf_can_run (perf, dirname, &is_explicit))
+ force = is_explicit;
+
while ((de = readdir (dir)) != NULL) {
char *trace;
struct stat st;
@@ -651,7 +670,7 @@ cairo_perf_trace_dir (cairo_perf_t *perf,
goto next;
num_traces++;
- if (! cairo_perf_can_run (perf, de->d_name))
+ if (!force && ! cairo_perf_can_run (perf, de->d_name, NULL))
goto next;
cairo_perf_trace (perf, target, trace);
diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c
index 21d48f42..0d60fc66 100644
--- a/perf/cairo-perf.c
+++ b/perf/cairo-perf.c
@@ -153,16 +153,24 @@ cairo_perf_has_similar (cairo_perf_t *perf)
cairo_bool_t
cairo_perf_can_run (cairo_perf_t *perf,
- const char *name)
+ const char *name,
+ cairo_bool_t *is_explicit)
{
unsigned int i;
+ if (is_explicit)
+ *is_explicit = FALSE;
+
if (perf->num_names == 0)
return TRUE;
- for (i = 0; i < perf->num_names; i++)
- if (strstr (name, perf->names[i]))
+ for (i = 0; i < perf->num_names; i++) {
+ if (strstr (name, perf->names[i])) {
+ if (is_explicit)
+ *is_explicit = FALSE;
return TRUE;
+ }
+ }
return FALSE;
}
diff --git a/perf/cairo-perf.h b/perf/cairo-perf.h
index 139de8e5..6903dbfa 100644
--- a/perf/cairo-perf.h
+++ b/perf/cairo-perf.h
@@ -98,7 +98,8 @@ typedef cairo_perf_ticks_t
cairo_bool_t
cairo_perf_can_run (cairo_perf_t *perf,
- const char *name);
+ const char *name,
+ cairo_bool_t *is_explicit);
void
cairo_perf_run (cairo_perf_t *perf,
diff --git a/perf/composite-checker.c b/perf/composite-checker.c
index 301006f9..0e61ec8d 100644
--- a/perf/composite-checker.c
+++ b/perf/composite-checker.c
@@ -83,7 +83,7 @@ composite_checker (cairo_perf_t *perf,
{
cairo_surface_t *image;
- if (! cairo_perf_can_run (perf, "composite-checker"))
+ if (! cairo_perf_can_run (perf, "composite-checker", NULL))
return;
/* Create the checker pattern. We don't actually need to draw
diff --git a/perf/dragon.c b/perf/dragon.c
index a145f781..eb8251c8 100644
--- a/perf/dragon.c
+++ b/perf/dragon.c
@@ -72,6 +72,7 @@ path (cairo_t *cr, int step, int dir, int iterations)
int i;
switch (dir) {
+ default:
case 0: dx = step; dy = 0; break;
case 1: dx = -step; dy = 0; break;
case 2: dx = 0; dy = step; break;
@@ -237,7 +238,7 @@ do_dragon_solid_circle_clip (cairo_t *cr, int width, int height, int loops)
void
dragon (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "dragon"))
+ if (! cairo_perf_can_run (perf, "dragon", NULL))
return;
cairo_perf_run (perf, "dragon-solid", do_dragon_solid);
diff --git a/perf/fill.c b/perf/fill.c
index 453f9a42..c65a649d 100644
--- a/perf/fill.c
+++ b/perf/fill.c
@@ -110,7 +110,7 @@ do_fill_eo_noaa (cairo_t *cr, int width, int height, int loops)
void
fill (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "fill"))
+ if (! cairo_perf_can_run (perf, "fill", NULL))
return;
cairo_perf_cover_sources_and_operators (perf, "fill", do_fill);
diff --git a/perf/glyphs.c b/perf/glyphs.c
index bead68c4..25175d54 100644
--- a/perf/glyphs.c
+++ b/perf/glyphs.c
@@ -92,7 +92,7 @@ out:
void
glyphs (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "glyphs"))
+ if (! cairo_perf_can_run (perf, "glyphs", NULL))
return;
cairo_perf_cover_sources_and_operators (perf, "glyphs", do_glyphs);
diff --git a/perf/intersections.c b/perf/intersections.c
index 1a00b1d1..0418ee31 100644
--- a/perf/intersections.c
+++ b/perf/intersections.c
@@ -146,7 +146,7 @@ random_curve_nz (cairo_t *cr, int width, int height, int loops)
void
intersections (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "intersections"))
+ if (! cairo_perf_can_run (perf, "intersections", NULL))
return;
cairo_perf_run (perf, "intersections-nz-fill", random_nz);
diff --git a/perf/long-dashed-lines.c b/perf/long-dashed-lines.c
index 96e6486c..c4de24f5 100644
--- a/perf/long-dashed-lines.c
+++ b/perf/long-dashed-lines.c
@@ -64,7 +64,7 @@ do_long_dashed_lines (cairo_t *cr, int width, int height, int loops)
void
long_dashed_lines (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "long-dashed-lines"))
+ if (! cairo_perf_can_run (perf, "long-dashed-lines", NULL))
return;
cairo_perf_run (perf, "long-dashed-lines", do_long_dashed_lines);
diff --git a/perf/long-lines.c b/perf/long-lines.c
index 124c4f2b..2b72879c 100644
--- a/perf/long-lines.c
+++ b/perf/long-lines.c
@@ -135,7 +135,7 @@ long_lines_cropped_once (cairo_t *cr, int width, int height, int loops)
void
long_lines (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "long-lines"))
+ if (! cairo_perf_can_run (perf, "long-lines", NULL))
return;
cairo_perf_run (perf, "long-lines-uncropped", long_lines_uncropped);
diff --git a/perf/mask.c b/perf/mask.c
index 55dc20a5..3050b447 100644
--- a/perf/mask.c
+++ b/perf/mask.c
@@ -275,7 +275,7 @@ do_mask_radial (cairo_t *cr, int width, int height, int loops)
void
mask (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "mask"))
+ if (! cairo_perf_can_run (perf, "mask", NULL))
return;
cairo_perf_cover_sources_and_operators (perf, "mask-solid",
diff --git a/perf/mosaic.c b/perf/mosaic.c
index 715dffb9..b7621057 100644
--- a/perf/mosaic.c
+++ b/perf/mosaic.c
@@ -163,7 +163,7 @@ mosaic_tessellate_curves (cairo_t *cr, int width, int height, int loops)
void
mosaic (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "mosaic"))
+ if (! cairo_perf_can_run (perf, "mosaic", NULL))
return;
cairo_perf_run (perf, "mosaic-fill-curves", mosaic_fill_curves);
diff --git a/perf/paint-with-alpha.c b/perf/paint-with-alpha.c
index cef353d5..5c23fe45 100644
--- a/perf/paint-with-alpha.c
+++ b/perf/paint-with-alpha.c
@@ -41,7 +41,7 @@ do_paint_with_alpha (cairo_t *cr, int width, int height, int loops)
void
paint_with_alpha (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "paint-with-alpha"))
+ if (! cairo_perf_can_run (perf, "paint-with-alpha", NULL))
return;
cairo_perf_cover_sources_and_operators (perf, "paint-with-alpha",
diff --git a/perf/paint.c b/perf/paint.c
index ac7c724e..bdc014c7 100644
--- a/perf/paint.c
+++ b/perf/paint.c
@@ -41,7 +41,7 @@ do_paint (cairo_t *cr, int width, int height, int loops)
void
paint (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "paint"))
+ if (! cairo_perf_can_run (perf, "paint", NULL))
return;
cairo_perf_cover_sources_and_operators (perf, "paint", do_paint);
diff --git a/perf/pattern_create_radial.c b/perf/pattern_create_radial.c
index 26dc713c..2959e740 100644
--- a/perf/pattern_create_radial.c
+++ b/perf/pattern_create_radial.c
@@ -84,7 +84,7 @@ 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"))
+ if (! cairo_perf_can_run (perf, "pattern-create-radial", NULL))
return;
srand (time (0));
diff --git a/perf/pythagoras-tree.c b/perf/pythagoras-tree.c
index bf37f5f3..f2200c98 100644
--- a/perf/pythagoras-tree.c
+++ b/perf/pythagoras-tree.c
@@ -84,8 +84,8 @@ do_pythagoras_tree (cairo_t *cr, int width, int height, int loops)
void
pythagoras_tree (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "pythagoras-tree"))
+ if (! cairo_perf_can_run (perf, "pythagoras-tree", NULL))
return;
- cairo_perf_run (perf, "pythagoras_tree", do_pythagoras_tree);
+ cairo_perf_run (perf, "pythagoras-tree", do_pythagoras_tree);
}
diff --git a/perf/rectangles.c b/perf/rectangles.c
index 53b908ec..601a0c59 100644
--- a/perf/rectangles.c
+++ b/perf/rectangles.c
@@ -100,7 +100,7 @@ rectangles (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
int i;
- if (! cairo_perf_can_run (perf, "rectangles"))
+ if (! cairo_perf_can_run (perf, "rectangles", NULL))
return;
srand (8478232);
diff --git a/perf/rounded-rectangles.c b/perf/rounded-rectangles.c
index 2cd89a8b..477abf2c 100644
--- a/perf/rounded-rectangles.c
+++ b/perf/rounded-rectangles.c
@@ -124,7 +124,7 @@ rounded_rectangles (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
int i;
- if (! cairo_perf_can_run (perf, "rounded-rectangles"))
+ if (! cairo_perf_can_run (perf, "rounded-rectangles", NULL))
return;
srand (8478232);
diff --git a/perf/spiral.c b/perf/spiral.c
index 123ad57b..046351c0 100644
--- a/perf/spiral.c
+++ b/perf/spiral.c
@@ -329,7 +329,7 @@ draw_spiral_stroke_na (cairo_t *cr, int width, int height, int loops)
void
spiral (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "spiral"))
+ if (! cairo_perf_can_run (perf, "spiral", NULL))
return;
cairo_perf_run (perf, "spiral-box-nonalign-evenodd-fill", draw_spiral_eo_na_box);
diff --git a/perf/stroke.c b/perf/stroke.c
index 81ba8f27..660dce57 100644
--- a/perf/stroke.c
+++ b/perf/stroke.c
@@ -89,7 +89,7 @@ do_strokes (cairo_t *cr, int width, int height, int loops)
void
stroke (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "stroke"))
+ if (! cairo_perf_can_run (perf, "stroke", NULL))
return;
cairo_perf_cover_sources_and_operators (perf, "stroke", do_stroke);
diff --git a/perf/subimage_copy.c b/perf/subimage_copy.c
index 9bec2fb0..0bfad80c 100644
--- a/perf/subimage_copy.c
+++ b/perf/subimage_copy.c
@@ -58,7 +58,7 @@ 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"))
+ if (! cairo_perf_can_run (perf, "subimage-copy", NULL))
return;
cairo_set_source_rgb (cr, 0, 0, 1); /* blue */
diff --git a/perf/tessellate.c b/perf/tessellate.c
index 1a4d978d..9debc539 100644
--- a/perf/tessellate.c
+++ b/perf/tessellate.c
@@ -144,7 +144,7 @@ tessellate_256 (cairo_t *cr, int width, int height, int loops)
void
tessellate (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "tessellate"))
+ if (! cairo_perf_can_run (perf, "tessellate", NULL))
return;
cairo_perf_run (perf, "tessellate-16", tessellate_16);
diff --git a/perf/text.c b/perf/text.c
index 9c512743..827bb883 100644
--- a/perf/text.c
+++ b/perf/text.c
@@ -59,7 +59,7 @@ do_text (cairo_t *cr, int width, int height, int loops)
void
text (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "text"))
+ if (! cairo_perf_can_run (perf, "text", NULL))
return;
cairo_perf_cover_sources_and_operators (perf, "text", do_text);
diff --git a/perf/twin.c b/perf/twin.c
index 4dd06dd0..b2c37a25 100644
--- a/perf/twin.c
+++ b/perf/twin.c
@@ -49,7 +49,7 @@ twin (cairo_perf_t *perf,
int width,
int height)
{
- if (! cairo_perf_can_run (perf, "twin"))
+ if (! cairo_perf_can_run (perf, "twin", NULL))
return;
cairo_perf_run (perf, "twin", do_twin);
diff --git a/perf/unaligned-clip.c b/perf/unaligned-clip.c
index 0bff2588..284c832a 100644
--- a/perf/unaligned-clip.c
+++ b/perf/unaligned-clip.c
@@ -63,7 +63,7 @@ do_unaligned_clip (cairo_t *cr, int width, int height, int loops)
void
unaligned_clip (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "unaligned-clip"))
+ if (! cairo_perf_can_run (perf, "unaligned-clip", NULL))
return;
cairo_perf_run (perf, "unaligned-clip", do_unaligned_clip);
diff --git a/perf/world-map.c b/perf/world-map.c
index d9a267dc..2a455002 100644
--- a/perf/world-map.c
+++ b/perf/world-map.c
@@ -109,7 +109,7 @@ do_world_map (cairo_t *cr, int width, int height, int loops)
void
world_map (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "world-map"))
+ if (! cairo_perf_can_run (perf, "world-map", NULL))
return;
cairo_perf_run (perf, "world-map", do_world_map);
diff --git a/perf/zrusin.c b/perf/zrusin.c
index d57c7c4b..24aff142 100644
--- a/perf/zrusin.c
+++ b/perf/zrusin.c
@@ -87,7 +87,7 @@ zrusin_another_fill (cairo_t *cr, int width, int height, int loops)
void
zrusin (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
- if (! cairo_perf_can_run (perf, "zrusin"))
+ if (! cairo_perf_can_run (perf, "zrusin", NULL))
return;
cairo_perf_run (perf, "zrusin-another-tessellate", zrusin_another_tessellate);