mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-25 15:20:10 +01:00
perf
This commit is contained in:
parent
3d51ec8a79
commit
2cb4eb53fe
1 changed files with 42 additions and 19 deletions
|
|
@ -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_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_save (c->cr);
|
||||
cairo_translate (c->cr, x, PAD / 2);
|
||||
cairo_rotate (c->cr, -M_PI/2);
|
||||
|
||||
cairo_set_source_rgb (c->cr, .5, .5, .5);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue