2006-08-31 07:19:05 -07:00
|
|
|
/*
|
2006-08-31 10:39:24 -07:00
|
|
|
* Copyright © 2006 Mozilla Corporation
|
2006-08-31 07:19:05 -07:00
|
|
|
* Copyright © 2006 Red Hat, Inc.
|
|
|
|
|
*
|
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software
|
|
|
|
|
* and its documentation for any purpose is hereby granted without
|
|
|
|
|
* fee, provided that the above copyright notice appear in all copies
|
|
|
|
|
* and that both that copyright notice and this permission notice
|
|
|
|
|
* appear in supporting documentation, and that the name of
|
2006-08-31 10:39:24 -07:00
|
|
|
* the authors not be used in advertising or publicity pertaining to
|
2006-08-31 07:19:05 -07:00
|
|
|
* distribution of the software without specific, written prior
|
2006-08-31 10:39:24 -07:00
|
|
|
* permission. The authors make no representations about the
|
2006-08-31 07:19:05 -07:00
|
|
|
* suitability of this software for any purpose. It is provided "as
|
|
|
|
|
* is" without express or implied warranty.
|
|
|
|
|
*
|
2006-08-31 10:39:24 -07:00
|
|
|
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
2006-08-31 07:19:05 -07:00
|
|
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
2006-08-31 10:39:24 -07:00
|
|
|
* FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL,
|
2006-08-31 07:19:05 -07:00
|
|
|
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
|
|
|
|
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
|
|
|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
|
|
|
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*
|
2006-08-31 10:39:24 -07:00
|
|
|
* Authors: Vladimir Vukicevic <vladimir@pobox.com>
|
|
|
|
|
* Carl Worth <cworth@cworth.org>
|
2006-08-31 07:19:05 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _CAIRO_PERF_H_
|
|
|
|
|
#define _CAIRO_PERF_H_
|
|
|
|
|
|
|
|
|
|
#include "cairo-boilerplate.h"
|
|
|
|
|
|
2006-11-07 12:57:48 -08:00
|
|
|
typedef uint64_t cairo_perf_ticks_t;
|
|
|
|
|
|
2008-10-16 11:56:19 +01:00
|
|
|
typedef struct _cairo_stats {
|
|
|
|
|
cairo_perf_ticks_t min_ticks;
|
|
|
|
|
cairo_perf_ticks_t median_ticks;
|
|
|
|
|
double ticks_per_ms;
|
|
|
|
|
double std_dev;
|
|
|
|
|
int iterations;
|
|
|
|
|
} cairo_stats_t;
|
2006-11-07 12:57:48 -08:00
|
|
|
|
2006-09-05 22:53:12 -07:00
|
|
|
/* timers */
|
|
|
|
|
|
|
|
|
|
void
|
2006-09-05 22:58:33 -07:00
|
|
|
cairo_perf_timer_start (void);
|
2006-09-05 22:53:12 -07:00
|
|
|
|
|
|
|
|
void
|
2006-09-05 22:58:33 -07:00
|
|
|
cairo_perf_timer_stop (void);
|
2006-09-05 22:53:12 -07:00
|
|
|
|
2006-09-09 20:17:08 -07:00
|
|
|
typedef void
|
2006-10-05 15:14:14 -07:00
|
|
|
(*cairo_perf_timer_synchronize_t) (void *closure);
|
2006-09-09 20:17:08 -07:00
|
|
|
|
|
|
|
|
void
|
2006-10-05 15:14:14 -07:00
|
|
|
cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t synchronize,
|
|
|
|
|
void *closure);
|
2006-09-09 20:17:08 -07:00
|
|
|
|
2006-09-06 00:15:49 -07:00
|
|
|
cairo_perf_ticks_t
|
2006-09-05 22:58:33 -07:00
|
|
|
cairo_perf_timer_elapsed (void);
|
2006-09-05 22:53:12 -07:00
|
|
|
|
2006-09-06 00:15:49 -07:00
|
|
|
cairo_perf_ticks_t
|
|
|
|
|
cairo_perf_ticks_per_second (void);
|
|
|
|
|
|
2006-09-05 22:53:12 -07:00
|
|
|
/* yield */
|
|
|
|
|
|
|
|
|
|
void
|
2006-09-05 22:58:33 -07:00
|
|
|
cairo_perf_yield (void);
|
2006-08-31 10:39:24 -07:00
|
|
|
|
2006-09-29 16:42:44 -07:00
|
|
|
/* running a test case */
|
2006-10-04 15:39:05 -07:00
|
|
|
typedef struct _cairo_perf {
|
2006-11-07 01:29:38 -08:00
|
|
|
/* Options from command-line */
|
2006-10-04 15:39:05 -07:00
|
|
|
unsigned int iterations;
|
2006-11-17 17:50:14 -08:00
|
|
|
cairo_bool_t exact_iterations;
|
2006-11-07 01:29:38 -08:00
|
|
|
cairo_bool_t raw;
|
|
|
|
|
cairo_bool_t list_only;
|
|
|
|
|
char **names;
|
|
|
|
|
unsigned int num_names;
|
|
|
|
|
|
|
|
|
|
/* Stuff used internally */
|
2008-05-08 09:00:56 +01:00
|
|
|
cairo_perf_ticks_t *times;
|
|
|
|
|
cairo_boilerplate_target_t **targets;
|
|
|
|
|
int num_targets;
|
2006-10-04 15:39:05 -07:00
|
|
|
cairo_boilerplate_target_t *target;
|
|
|
|
|
unsigned int test_number;
|
|
|
|
|
unsigned int size;
|
|
|
|
|
cairo_t *cr;
|
|
|
|
|
} cairo_perf_t;
|
2006-09-29 16:42:44 -07:00
|
|
|
|
2006-09-06 00:15:49 -07:00
|
|
|
typedef cairo_perf_ticks_t
|
|
|
|
|
(*cairo_perf_func_t) (cairo_t *cr, int width, int height);
|
2006-08-31 07:19:05 -07:00
|
|
|
|
2006-09-29 16:42:44 -07:00
|
|
|
void
|
|
|
|
|
cairo_perf_run (cairo_perf_t *perf,
|
|
|
|
|
const char *name,
|
|
|
|
|
cairo_perf_func_t perf_func);
|
|
|
|
|
|
2006-10-04 15:39:05 -07:00
|
|
|
void
|
|
|
|
|
cairo_perf_cover_sources_and_operators (cairo_perf_t *perf,
|
|
|
|
|
const char *name,
|
|
|
|
|
cairo_perf_func_t perf_func);
|
|
|
|
|
|
2008-10-16 11:56:19 +01:00
|
|
|
/* reporter convenience routines */
|
|
|
|
|
|
|
|
|
|
typedef struct _test_report {
|
|
|
|
|
int id;
|
|
|
|
|
const char *configuration;
|
|
|
|
|
char *backend;
|
|
|
|
|
char *content;
|
|
|
|
|
char *name;
|
|
|
|
|
int size;
|
|
|
|
|
|
|
|
|
|
/* The samples only exists for "raw" reports */
|
|
|
|
|
cairo_perf_ticks_t *samples;
|
|
|
|
|
unsigned int samples_size;
|
|
|
|
|
unsigned int samples_count;
|
|
|
|
|
|
|
|
|
|
/* The stats are either read directly or computed from samples.
|
|
|
|
|
* If the stats have not yet been computed from samples, then
|
|
|
|
|
* iterations will be 0. */
|
|
|
|
|
cairo_stats_t stats;
|
|
|
|
|
} test_report_t;
|
|
|
|
|
|
|
|
|
|
typedef struct _test_diff {
|
|
|
|
|
test_report_t **tests;
|
|
|
|
|
int num_tests;
|
|
|
|
|
double min;
|
|
|
|
|
double max;
|
|
|
|
|
double change;
|
|
|
|
|
} test_diff_t;
|
|
|
|
|
|
|
|
|
|
typedef struct _cairo_perf_report {
|
|
|
|
|
char *configuration;
|
|
|
|
|
const char *name;
|
|
|
|
|
test_report_t *tests;
|
|
|
|
|
int tests_size;
|
|
|
|
|
int tests_count;
|
|
|
|
|
} cairo_perf_report_t;
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
TEST_REPORT_STATUS_SUCCESS,
|
|
|
|
|
TEST_REPORT_STATUS_COMMENT,
|
|
|
|
|
TEST_REPORT_STATUS_ERROR
|
|
|
|
|
} test_report_status_t;
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_perf_report_load (cairo_perf_report_t *report,
|
|
|
|
|
const char *filename);
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_perf_report_sort_and_compute_stats (cairo_perf_report_t *report);
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
test_report_cmp_backend_then_name (const void *a, const void *b);
|
|
|
|
|
|
2008-02-01 18:45:59 -08:00
|
|
|
#define CAIRO_PERF_DECL(func) void (func) (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
2006-08-31 07:19:05 -07:00
|
|
|
|
2006-10-04 16:16:03 -07:00
|
|
|
CAIRO_PERF_DECL (fill);
|
2006-09-29 16:42:44 -07:00
|
|
|
CAIRO_PERF_DECL (paint);
|
2007-04-23 09:35:35 -07:00
|
|
|
CAIRO_PERF_DECL (paint_with_alpha);
|
2006-10-04 16:16:03 -07:00
|
|
|
CAIRO_PERF_DECL (stroke);
|
2006-10-05 12:13:48 -07:00
|
|
|
CAIRO_PERF_DECL (subimage_copy);
|
2006-09-29 16:42:44 -07:00
|
|
|
CAIRO_PERF_DECL (tessellate);
|
2006-10-04 18:35:16 -07:00
|
|
|
CAIRO_PERF_DECL (text);
|
2006-10-31 23:47:35 -08:00
|
|
|
CAIRO_PERF_DECL (pattern_create_radial);
|
2006-11-06 23:56:19 -08:00
|
|
|
CAIRO_PERF_DECL (zrusin);
|
2006-11-08 05:45:09 -08:00
|
|
|
CAIRO_PERF_DECL (world_map);
|
2006-11-17 17:50:14 -08:00
|
|
|
CAIRO_PERF_DECL (box_outline);
|
2006-12-16 20:00:56 +02:00
|
|
|
CAIRO_PERF_DECL (mosaic);
|
2007-01-03 16:27:52 -08:00
|
|
|
CAIRO_PERF_DECL (long_lines);
|
2007-01-09 14:27:32 -08:00
|
|
|
CAIRO_PERF_DECL (unaligned_clip);
|
2007-01-31 11:53:06 -08:00
|
|
|
CAIRO_PERF_DECL (rectangles);
|
2008-09-28 18:57:15 +01:00
|
|
|
CAIRO_PERF_DECL (rounded_rectangles);
|
2007-06-18 13:58:15 -07:00
|
|
|
CAIRO_PERF_DECL (long_dashed_lines);
|
2008-10-08 20:08:25 +01:00
|
|
|
CAIRO_PERF_DECL (composite_checker);
|
2008-10-30 19:14:07 +00:00
|
|
|
CAIRO_PERF_DECL (twin);
|
2007-12-18 10:49:23 +00:00
|
|
|
CAIRO_PERF_DECL (dragon);
|
2007-12-18 11:23:33 +00:00
|
|
|
CAIRO_PERF_DECL (pythagoras_tree);
|
2008-09-12 17:32:40 +03:00
|
|
|
CAIRO_PERF_DECL (intersections);
|
2006-08-31 07:19:05 -07:00
|
|
|
|
|
|
|
|
#endif
|