Commit graph

363 commits

Author SHA1 Message Date
Andrea Canciani
761ef7ae8b cairo-missing: Fix and cleanup ssize_t type definition
The definition of ssize_t is needed in cairo-missing.h and can be
dropped from files which include it.
2011-09-04 16:23:37 -07:00
Andrea Canciani
1bcc27985f perf: Fix win32 build
Microsoft C Compiler complains about:

hash-table.c(44) : error C2466: cannot allocate an array of constant
size 0

Adding an unused element makes it happy.
2011-09-02 12:52:47 +02:00
Andrea Canciani
297aa4d4a0 perf: Fix readme
The README in perf/ was not updated when cairo-perf.c was renamed to
cairo-perf-micro.c
2011-09-02 12:45:49 +02:00
Andrea Canciani
dcd3e2cde1 perf: Get rid of cairo_perf_ticks_per_second()
The cairo_time_from_s() and cairo_time_to_s() functions should be used
instead.
2011-09-02 12:45:49 +02:00
Andrea Canciani
9172e2aec0 perf: Drop cairo_perf_ticks_t in favor of cairo_time_t
cairo_time_t offers a superset of the functions provided by
cairo_perf_ticks_t.
2011-09-02 12:45:49 +02:00
Andrea Canciani
2855ff4666 perf: Reuse cairo-time
Instead of redefining time getters, use the generic one provided by
_cairo_time_*.
2011-09-02 12:45:49 +02:00
Andrea Canciani
6d6bfbd641 Introduce the cairo-missing library
The cairo-missing library provides the functions which are needed in
order to correctly compile cairo (or its utilities) and which were not
found during configuration.

Fixes the build on MacOS X Lion, which failed because of collisons
between the cairo internal getline and strndup and those in libc:

cairo-analyse-trace.c:282: error: static declaration of ‘getline’ follows non-static declaration
/usr/include/stdio.h:449: error: previous declaration of ‘getline’ was here
cairo-analyse-trace.c:307: error: static declaration of ‘strndup’ follows non-static declaration
...
2011-09-02 12:27:13 +02:00
Andrea Canciani
0101a54579 time: Add cairo_time_t type
Add the cairo_time_t type (currently based on cairo_uint64_t) and use
it in cairo-observer and in the perf suite.

Fixes the build on MacOS X (for the src/ subdir) and Win32, whch
failed because they don't provide clock_gettime:

cairo-surface-observer.c:629: error: implicit declaration of function 'clock_gettime'
cairo-surface-observer.c:629: warning: nested extern declaration of 'clock_gettime'
cairo-surface-observer.c:629: error: 'CLOCK_MONOTONIC' undeclared (first use in this function)
...
2011-09-02 12:27:13 +02:00
Andrea Canciani
6fd174b423 perf: Silence gcc warning
Silence:

dragon.c: In function 'do_dragon_solid':
dragon.c:167: warning: unused variable 'r'
2011-09-02 12:00:29 +02:00
Chris Wilson
6b1daace57 perf: Print a summary of each operation for a trace (using '-s')
In order for this to be effective on small system we also need to
disable the recording of the long traces which exhaust all memory...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-30 13:28:47 +01:00
Chris Wilson
6cdad1931a observe: Provide the sum of the elapsed time of the individual operations
We can use the elapsed time of the indiividual operations to profile the
synchronous throughput of a trace and eliminate all replay overhead. At
the cost of running the trace synchronously of course.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-23 14:41:10 +01:00
Chris Wilson
0efdc8d27e observer: record all operations and their timings
The immediate use of this is to print out the slowest operation of each
type in a replayable manner. A continuing demonstration of how we may
analyse traces...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-20 11:51:50 +01:00
Chris Wilson
713c8069be perf: Cleanup target after each run
As the trace may leak surfaces over its lifetime, we are forced to
teardown the connection between runs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-19 22:32:31 +01:00
Chris Wilson
eee66899cd Introduce cairo_surface_observer_t for performance analysis
Another logging passthrough surface that records the style of operations
performed trying to categorise what is slow/fast/important.

In combination with perf/cairo-analyse-trace it is very useful for
understanding what a trace does. The next steps for this tool would be
to identify the slow operations that the trace does. Baby steps.

This should be generally useful in similar situations outside of perf/
and should be extensible to become an online performance probe.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-14 20:54:53 +01:00
Chris Wilson
6d1c0e6d28 Fix pollution from skia commit
I forgot to proof-read the patch before pushing and forgot I had left in
some damage from trying to get skia to link using libtool.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 10:06:08 +01:00
Chris Wilson
1ccd269a3f skia: Update to use cairo_backend_t interface
Still hopelessly broken. Requires compiling cairo to use static linking
and then still requires manual linkage to workaround libtool. Lots of
functionality is still absent - we need to either find analogues to some
Cairo operations or implement fallbacks - but it is sufficient to
investigate how Skia functions in direct comparison with Cairo for
tessellation/rasterisation.

Caveat emptor.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 09:58:02 +01:00
Chris Wilson
2e545672ba perf/micro: diagonal lines
The ideal benchmark for spans?...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 09:30:26 +01:00
Chris Wilson
e9d41054f9 perf/micro: Test wide vs hairline strokes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 09:30:26 +01:00
Chris Wilson
d22cf3dfbe perf: add curve
Time how long it takes to stroke and fill a single Bezier curve.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 20:20:18 +01:00
Chris Wilson
aa6df71228 perf: add many-curves
Continuing the theme of stressing the tessellators, draw lots of Bezier
curves!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 19:47:49 +01:00
Chris Wilson
786d4b2a2a perf: Add many-fills
A variant of many-strokes tries to answer the question of how much
overhead is there in stroking, i.e. if we fill an equivalent path to a
set of strokes, do we see an equivalence in performance?

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 16:06:50 +01:00
Chris Wilson
f646cb07a9 perf: add the usual special cases to many-strokes
For completeness, also compare [aligned] horizontal and vertical
strokes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-07 12:27:39 +01:00
Chris Wilson
d953161f88 perf: Add many-strokes
An intersection variant to exercise the stroker with many, many lines. A
silly benchmark, but a popular one in the wild.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-07 12:14:11 +01:00
Chris Wilson
1e8d56ceeb perf: Add stroke/fill variants to world-map
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-05 09:48:14 +01:00
Uli Schlachter
971d42302c perf: Also build the code in perf/micro
This fixes weird and occasional build failures when updating the source, e.g.:

cairo-perf-micro.o:(.rodata+0xb0): undefined reference to `hash_table'

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-04 21:10:09 +02:00
Andrea Canciani
374b26ff03 perf: Add hash table benchmark
A benchmark to test the speed of hash tables when inserting and
removing a huge number of elements.

Although originally hash tables were assumed not to get many
deletions, in practice they are now being used as caches in multiple
places. This means that they often have a fixed number of live
elements and an element is evicted whenever a new element is inserted
(this happens explicitly for cairo_cache_t objects, but also, for
example, in scaled_font_map + holdovers). This access pattern is very
inefficient with the current implementation.
2011-08-03 12:31:41 +02:00
Chris Wilson
c5405f7324 perf: Save/restore gstate across runs
Reset the cairo_t to the initial state so that subsequent tests are not
affected by earlier tests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-01 12:59:06 +01:00
Chris Wilson
fec80f1199 perf: Add a few more variations to dragon to exercise unaligned lines/spans
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-01 12:08:55 +01:00
Andrea Canciani
e04e368748 Remove useless checks for NULL before freeing
This patch has been generated by the following Coccinelle semantic patch:
// Remove useless checks for NULL before freeing
//
// free (NULL) is a no-op, so there is no need to avoid it

@@
expression E;
@@
+ free (E);
+ E = NULL;
- if (unlikely (E != NULL)) {
-   free(E);
(
-   E = NULL;
|
-   E = 0;
)
   ...
- }

@@
expression E;
@@
+ free (E);
- if (unlikely (E != NULL)) {
-   free (E);
- }
2011-07-31 16:46:36 +02:00
Andrea Canciani
e8e765605c Silence gcc warnings 2011-07-29 10:51:19 +02:00
Chris Wilson
9ab9ecfdbd test,perf: Another hatching!
This one illustrates the quadratic explosion lurking in the clipping
code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-19 00:32:45 +01:00
Chris Wilson
3a29365713 tests,perf: Add a hatchings clip-test
A benchmark to test how close we get to reducing paint+clip to an ordinary
fill, and to check correctness.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-18 10:31:25 +01:00
Nis Martensen
1a4e9f1e91 Fix typos
Reported in
http://lists.cairographics.org/archives/cairo/2011-May/021921.html
2011-06-25 10:19:23 +02:00
Andrea Canciani
463a8b67a3 perf: Fix build on win32
The performance tools build system for Win32 hasn't been maintained
for some time.  The makefiles are now structured as in other
directories (Makefile.sources used by both Makefile.am and
Makefile.win32) and some additional code hides os-specific parts.
2011-06-24 14:13:09 +02:00
Andrea Canciani
33403cfb37 perf: Ensure M_SQRT2 is defined
pythagoras-tree uses M_SQRT2, which on Win32 is defined by math.h if
and only if _USE_MATH_DEFINES is defined.
2011-06-24 14:13:09 +02:00
Andrea Canciani
f21ac5b13b error: Do not define _cairo_error twice
cairo-perf-trace uses cairo-hash.c, which calls _cairo_error.

Instead of redefining it in cairo-perf-trace.c it can be abstracted in
a separate source which is directly included in the build of
cairo-perf-trace.

This avoids visibility issues when compiling cairo-perf-trace with a
statically linked cairo library on architectures which do not support
hidden visibility (example: win32).
2011-06-24 11:57:22 +02:00
Chris Wilson
27d26bb8b5 cairo-perf-diff-files: Don't print size/content for trace results
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-06 15:09:50 +01:00
Chris Wilson
bf1b08d066 perf 2011-06-02 08:57:13 +01:00
Chris Wilson
52f79bfcf3 perf/micro: Add wave
Benjamin just demonstrated this funky trick for generating pixel
outlines, and as no good deed should go unpunished, I've added his code
to the perf suite.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-01 19:17:06 +01:00
Chris Wilson
c6c3bdba4b perf: Only print description once per backend
Currently we print the backend description before every time, which is
overly verbose. As the information doesn't^Wshouldn't change, simply
print it before running the first test of each target.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-10-20 14:26:37 +01:00
David Schleef
73470862cb perf: Fix README to say cairo-perf-micro 2010-08-10 02:37:38 +02:00
Andrea Canciani
7668323649 perf: Improve calibration
Make the loops count depend on the actual calibration_loops/calibration_time
instead of calibration_loops/calibration_max_time.
This avoids having some tests take much less/more than the wanted time per iteration
(I was having some tests taking about 1 second, other taking about 7 seconds when
the ms_per_iteration was 2000)

Spend 0.5-1 times the time wanted for each iteration in calibration, increase the
accuracy of loops count. Just making the loops count be the correct ratio doesn't
guarantee that the iteration time is accurate. By actually measuring iteration
times until it gets greater than 1/4 of the wanted time, the total sum is bound
to be <= the wanted iteration time and last calibration time is between 1/4 and
1/2 of the wanted time, so it should give a very accurate loop count.
2010-08-09 19:19:04 +02:00
Benjamin Otte
9ce87c67ff perf: print comment describing backend
Use the descibe string to output information about the backend we're
testing.
2010-07-03 02:55:52 +02:00
M Joonas Pihlaja
b036a09972 whitespace: Fixup formal arguments and tabs in boilerplate/ and perf/.
Ran a script to align the formal parameters of functions and
collapse spaces to tabs in code.
2010-06-24 15:02:53 +03:00
M Joonas Pihlaja
800e977c2e perf: Allow comparing perf reports with only one difference.
The cairo-perf-diff-files tool would ignore perf reports with
just one test for no apparent reason.  The traces take so long
that it's useful to be able to compare runs with just one trace.
2010-06-17 14:27:13 +03:00
Chris Wilson
0d5a15f238 check: Disable running cairo-perf-micro
Since this takes days to run now and should not find any bugs that are
not covered by the test-suite it seems like a pointless exercise.
Especially as I am trying to make a release!
2010-06-12 20:02:39 +01:00
Andrea Canciani
061ea78ad2 perf: Correct cairo-perf-diff syntax
{ cmd-list; } seems to literally be the required syntax. Blanks and
';' are both mandatory.
2010-04-10 18:25:25 +02:00
Chris Wilson
f5f6431787 perf: Switch between micro and trace benchmarks for cairo-perf-diff 2010-04-07 22:50:15 +01:00
Chris Wilson
fe610d559c perf/micro: Show megapixel fill rate during paint. 2010-04-02 08:51:03 +01:00
Andrea Canciani
a81d347c24 perf: Fix timestamp computation on MacOS X
The OIL routines don't work as expected on MacOS X. The operating
system gives access to the timestamp counter through the function
mach_absolute_time.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-03-31 16:13:05 +02:00