summaryrefslogtreecommitdiff
path: root/perf
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-10-09 19:53:16 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-10-11 09:05:44 +0100
commit2cb4eb53feb9223db8db66c9f86d962cc7248f27 (patch)
tree41ee055bd3554d251e8cbd3c5315aaf88cba5da8 /perf
parent3d51ec8a7928f313d73023cabe0d760cf1946458 (diff)
perf
Diffstat (limited to 'perf')
-rw-r--r--perf/cairo-perf-chart.c61
1 files changed, 42 insertions, 19 deletions
diff --git a/perf/cairo-perf-chart.c b/perf/cairo-perf-chart.c
index 70ff3538..0ecf8b47 100644
--- a/perf/cairo-perf-chart.c
+++ b/perf/cairo-perf-chart.c
@@ -54,7 +54,7 @@ struct color {
};
#define FONT_SIZE 12
-#define PAD (FONT_SIZE/2+1)
+#define PAD (4)
#define MAX(a,b) ((a) > (b) ? (a) : (b))
@@ -108,13 +108,13 @@ trim_outliers (double *values,
qsort (values, num_values,
sizeof (double), _double_cmp);
- q1 = values[1*num_values / 4];
- q3 = values[3*num_values / 4];
+ q1 = values[1*num_values / 6];
+ q3 = values[5*num_values / 6];
iqr = q3 - q1;
- outlier_min = q1 - 1.5 * iqr;
- outlier_max = q3 + 1.5 * iqr;
+ outlier_min = q1 - 3 * iqr;
+ outlier_max = q3 + 3 * iqr;
i = 0;
while (i < num_values && values[i] < outlier_min)
@@ -140,6 +140,8 @@ find_ranges (struct chart *chart)
double test_time;
int seen_non_null;
int num_tests = 0;
+ double slow_sum = 0, fast_sum = 0, sum;
+ int slow_count = 0, fast_count = 0;
int i;
num_values = 0;
@@ -201,17 +203,25 @@ find_ranges (struct chart *chart)
test_time = report_time;
if (chart->relative) {
- double v = to_factor (test_time / report_time);
- if (num_values == size_values) {
- size_values *= 2;
- values = xrealloc (values,
- size_values * sizeof (double));
+ if (test_time != report_time) {
+ double v = to_factor (test_time / report_time);
+ if (num_values == size_values) {
+ size_values *= 2;
+ values = xrealloc (values,
+ size_values * sizeof (double));
+ }
+ values[num_values++] = v;
+ if (v < min)
+ min = v;
+ if (v > max)
+ max = v;
+ if (v > 0)
+ fast_sum += v/100, fast_count++;
+ else
+ slow_sum += v/100, slow_count++;
+ sum += v/100;
+ printf ("%s %d: %f\n", min_test->name, num_values, v);
}
- values[num_values++] = v;
- if (v < min)
- min = v;
- if (v > max)
- max = v;
} else {
if (report_time < min)
min = report_time;
@@ -230,6 +240,9 @@ find_ranges (struct chart *chart)
free (values);
free (tests);
+
+ printf ("%d: slow[%d] average: %f, fast[%d] average: %f, %f\n",
+ num_values, slow_count, slow_sum / slow_count, fast_count, fast_sum / fast_count, sum / num_values);
}
#define SET_COLOR(C, R, G, B) (C)->red = (R), (C)->green = (G), (C)->blue = (B)
@@ -390,19 +403,29 @@ add_label (struct chart *c,
cairo_save (c->cr);
dx = c->width / (double) c->num_tests;
- if (dx / 2 - PAD < 6)
+ if (dx / 2 - PAD < 4)
return;
cairo_set_font_size (c->cr, dx / 2 - PAD);
cairo_text_extents (c->cr, label, &extents);
+ cairo_set_source_rgb (c->cr, .5, .5, .5);
+
x = (test + .5) * dx;
- cairo_translate (c->cr, x, PAD / 2);
+ cairo_save (c->cr);
+ cairo_translate (c->cr, x, c->height - PAD / 2);
cairo_rotate (c->cr, -M_PI/2);
+ cairo_move_to (c->cr, 0, -extents.y_bearing/2);
+ cairo_show_text (c->cr, label);
+ cairo_restore (c->cr);
- cairo_set_source_rgb (c->cr, .5, .5, .5);
+ cairo_save (c->cr);
+ cairo_translate (c->cr, x, PAD / 2);
+ cairo_rotate (c->cr, -M_PI/2);
cairo_move_to (c->cr, -extents.width, -extents.y_bearing/2);
cairo_show_text (c->cr, label);
cairo_restore (c->cr);
+
+ cairo_restore (c->cr);
}
static void
@@ -840,7 +863,7 @@ main (int argc,
chart.names[chart.num_reports] = argv[i] + 7;
} else {
cairo_perf_report_load (&chart.reports[chart.num_reports++],
- argv[i],
+ argv[i], i,
test_report_cmp_name);
}
}