From 0d1340f7169920c901a0f6d6f8ecb4529e57ada4 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 8 Nov 2006 05:39:06 -0800 Subject: [PATCH] perf: Eliminate CAIRO_STATS_MIN_VALID_SAMPLES We don't need this at this deep level since callers can now implement this limiting manually since stats.iterations is now returned. Also, this was interfering with the -i option to cairo-perf anyway. --- perf/cairo-perf.c | 7 ++----- perf/cairo-stats.c | 7 +------ perf/cairo-stats.h | 9 +-------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c index 4345beea6..432c3a622 100644 --- a/perf/cairo-perf.c +++ b/perf/cairo-perf.c @@ -105,7 +105,6 @@ cairo_perf_run (cairo_perf_t *perf, cairo_perf_func_t perf_func) { static cairo_bool_t first_run = TRUE; - cairo_stats_status_t status; unsigned int i; cairo_perf_ticks_t *times; cairo_stats_t stats = {0.0, 0.0}; @@ -155,10 +154,8 @@ cairo_perf_run (cairo_perf_t *perf, cairo_perf_ticks_per_second () / 1000.0); printf (" %lld", times[i]); } else { - if (i >= CAIRO_STATS_MIN_VALID_SAMPLES) { - status = _cairo_stats_compute (&stats, times, i+1); - if (status == CAIRO_STATS_STATUS_NEED_MORE_DATA) - continue; + if (i > 0) { + _cairo_stats_compute (&stats, times, i+1); if (stats.std_dev <= CAIRO_PERF_LOW_STD_DEV) { low_std_dev_count++; diff --git a/perf/cairo-stats.c b/perf/cairo-stats.c index b9921d87d..ba652d024 100644 --- a/perf/cairo-stats.c +++ b/perf/cairo-stats.c @@ -38,7 +38,7 @@ _cairo_perf_ticks_cmp (const void *_a, const void *_b) return 0; } -cairo_stats_status_t +void _cairo_stats_compute (cairo_stats_t *stats, cairo_perf_ticks_t *values, int num_values) @@ -78,9 +78,6 @@ _cairo_stats_compute (cairo_stats_t *stats, while (i + num_valid < num_values && values[i+num_valid] < outlier_max) num_valid++; - if (num_valid < CAIRO_STATS_MIN_VALID_SAMPLES) - return CAIRO_STATS_STATUS_NEED_MORE_DATA; - stats->iterations = num_valid; stats->min_ticks = values[min_valid]; @@ -103,6 +100,4 @@ _cairo_stats_compute (cairo_stats_t *stats, /* Let's use a std. deviation normalized to the mean for easier * comparison. */ stats->std_dev = sqrt(sum / num_valid) / mean; - - return CAIRO_STATS_STATUS_SUCCESS; } diff --git a/perf/cairo-stats.h b/perf/cairo-stats.h index e394f0384..3f8a988d9 100644 --- a/perf/cairo-stats.h +++ b/perf/cairo-stats.h @@ -28,13 +28,6 @@ #include "cairo-perf.h" -#define CAIRO_STATS_MIN_VALID_SAMPLES 20 - -typedef enum { - CAIRO_STATS_STATUS_SUCCESS, - CAIRO_STATS_STATUS_NEED_MORE_DATA -} cairo_stats_status_t; - typedef struct _cairo_stats { cairo_perf_ticks_t min_ticks; cairo_perf_ticks_t median_ticks; @@ -43,7 +36,7 @@ typedef struct _cairo_stats { int iterations; } cairo_stats_t; -cairo_stats_status_t +void _cairo_stats_compute (cairo_stats_t *stats, cairo_perf_ticks_t *values, int num_values);