diff options
author | Siarhei Siamashka <siarhei.siamashka@gmail.com> | 2012-12-22 04:19:08 +0200 |
---|---|---|
committer | Siarhei Siamashka <siarhei.siamashka@gmail.com> | 2012-12-22 04:19:08 +0200 |
commit | 7a04337b4b2ed692e9b48b3ca7c9ffdd126ba627 (patch) | |
tree | 1d2c7c10d98d9ad85d2072abb4a12a125ca6e850 |
Initial import from http://cgit.freedesktop.org/cairo-traces
Revision cdb266e660743e680314ef4b0c4655a311f32ca4
The traces are not included yet to save space.
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | COPYING | 21 | ||||
-rw-r--r-- | Makefile | 67 | ||||
-rw-r--r-- | README | 162 | ||||
-rw-r--r-- | csi-bind.c | 19 | ||||
-rw-r--r-- | csi-trace.c | 96 |
6 files changed, 369 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a4889ca --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.trace +csi-bind +csi-trace +snapshots @@ -0,0 +1,21 @@ +This repository of traces is available under a liberal MIT/X11 license to +encourage and promote the use of these traces as a diagnosis and benchmarking +tool. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e8f8b6b --- /dev/null +++ b/Makefile @@ -0,0 +1,67 @@ +NULL := +FULL_LZMA := $(wildcard full/*.lzma) +WEBKIT_LZMA := $(wildcard webkit/*.lzma) +QUICK_LZMA := $(wildcard benchmark/*.lzma) +ALL_LZMA:= $(FULL_LZMA) $(WEBKIT_LZMA) $(QUICK_LZMA) +ALL_TRACES := $(ALL_LZMA:.lzma=.trace) + +all: $(ALL_TRACES) +benchmarks: $(QUICK_LZMA:.lzma=.trace) + +%.trace: %.lzma csi-bind + lzma -cd $< | ./csi-bind > $@ + +csi-bind: csi-bind.c + $(CC) $(CFLAGS) $(shell pkg-config cairo --cflags) $^ $(shell pkg-config cairo --libs) -lcairo-script-interpreter -o $@ +csi-trace: csi-trace.c + $(CC) $(CFLAGS) $(shell pkg-config cairo --cflags) $^ $(shell pkg-config cairo --libs) -lcairo-script-interpreter -o $@ + +########################################################## +# Some targets to make and upload a snapshot of the traces +# Based on cairo/build/Makefile.am.releasing +# Use: +# make snapshot snapshot-upload + +TAR_OPTIONS = --owner=0 --group=0 + +RELEASE_OR_SNAPSHOT = snapshot +RELEASE_UPLOAD_HOST = cairographics.org +RELEASE_UPLOAD_BASE = /srv/cairo.freedesktop.org/www +RELEASE_UPLOAD_DIR = $(RELEASE_UPLOAD_BASE)/$(RELEASE_OR_SNAPSHOT)s +RELEASE_URL_BASE = http://cairographics.org/$(RELEASE_OR_SNAPSHOT)s +RELEASE_ANNOUNCE_LIST = cairo-announce@cairographics.org + +snapshots := snapshots +snapshot_name := $(shell date '+%Y%m%d')-$(shell git rev-parse HEAD | cut -c 1-6) +tar_file := $(snapshots)/cairo-traces-$(snapshot_name).tar.gz +sha1_file := $(tar_file).sha1 +gpg_file := $(sha1_file).asc + +SNAPSHOT_DIST := Makefile README $(wildcard *.c) $(QUICK_LZMA) +$(tar_file): $(SNAPSHOT_DIST) + @mkdir -p $(snapshots) + @echo Generating snapshot tarball: $(tar_file) + @tar $(TAR_OPTIONS) --transform 's#^#cairo-traces-$(snapshot_name)/#' -czvf $(tar_file) $(SNAPSHOT_DIST) + +$(sha1_file): $(tar_file) + sha1sum $^ > $@ + +$(gpg_file): $(sha1_file) + @echo "Please enter your GPG password to sign the checksum." + gpg --armor --sign $^ + +snapshot-dirty: + @if test -n "$(shell git ls-files -m $(SNAPSHOT_DIST))"; then \ + echo "Local tree has uncommitted modifications. Please commit these changes before making a snapshot." ; \ + exit 1; \ + fi + +snapshot: snapshot-dirty $(gpg_file) + +snapshot-upload: snapshot + scp $(tar_file) $(sha1_file) $(gpg_file) $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR) + +############################################################ + +clean: + rm -f $(ALL_TRACES) csi-bind csi-trace $(snapshots) @@ -0,0 +1,162 @@ +This directory contains a collection of traces that represent applications +in the wild. In particular, they represent behaviour that someone thought +worthy of further study and analysis! + +To capture a trace: +$ cairo-trace --profile application [args...] +This will produce a application.$pid.lzma file. If you think it is +interesting add it to this repository, giving it a short but descriptive +name, and add a note here explaining what the trace captures. + +To replay traces: +Use cairo/perf/cairo-perf-trace. By default cairo-perf-trace will loop +over all traces within cairo/perf/cairo-traces for all test targets. To run +against a subset specify a series of traces on the command line and use the +CAIRO_TEST_TARGET environment variable to filter the target. For example, +CAIRO_TEST_TARGET=xlib ./cairo-perf-trace firefox. + +Guidelines +---------- +Initial thoughts... + +1. Nothing obscene, or otherwise unsuitable for viewing by children or in the +workplace - please be considerate to others. The trace should also respect +copyright where appropriate. Even though the content is not usually visible +during a replay, it is not acceptable to distribute such material via +freedesktop.org. + +2. Each trace must be "representative of a significant use". The goal is a +set of traces that capture the behaviour of real applications during active +sessions. (We must guard against the tests becoming too artificial as that +is better served by purpose-written micro-benchmarks.) + +3. For practical reasons (i.e. continuous performance testing), each trace +should neither be profligate in the resources consumed nor the duration of +the run. However, I'm loathe to exclude tests simply because they take too +long or can not be run on tiny machines. (Instead, I plan to create subset +of tests that have been truncated to run within 60s on a 2GHz Intel Core2.) + +4. If the application significantly improves such that the current trace +is no longer representative of that application, it must be replaced. This +is to ensure that we do not try to optimise for "historically broken +behaviour". + +Traces (found in the full/ directory) +------------------------------------- +firefox-20090601 - browsing various news site, in particular the + international BBC News website. +firefox-36-20090609 - browsing news sites and blogs at font size 36 + Warning: this needs lots of RAM, working set > 512 MiB. +firefox-36-20090611 - browsing http://www.bbc.co.uk/worldservice/languages/, + single page at a time with font size 36 + Warning: this needs lots of RAM, working set > 512 MiB. +firefox-woodtv - A page with a gratiutiously large and obscured background, + can cause misbehaving drivers to freeze! + http://www.woodtv.com/ +firefox-world-map - Rotating a vector map of the world: + http://people.mozilla.com/~jmuizelaar/world-map.html +firefox-periodic-table - Resizing a German periodic table of the elements + http://upload.wikimedia.org/wikipedia/commons/6/63/Periodic_table_(german)_4.svg +firefox-talos-gfx-20090702 - Firefox Talos performance suite, gfx tests (SYNTHETIC) + https://wiki.mozilla.org/StandaloneTalos tgfx +firefox-talos-svg-20090702 - Firefox Talos performance suite, svg tests (SYNTHETIC) + https://wiki.mozilla.org/StandaloneTalos tsvg + +gnome-terminal-20090601 - exercising the various performance tests within vte +gnome-terminal-20090728 - ls -lR /usr + A real-world example of a many glyphs micro-benchmark! + +evolution-20090605 - perusing some old cairo@ mail + +swfdec-giant-steps-full - http://michalevy.com/wp-content/uploads/Giant%20Steps%202007.swf +swfdec-youtube-full - http://www.youtube.com/v/l6IAoPAjzpw&hl=en&fs=1& +swfdec-fill-rate - an example slideshow created from www.slide.com +swfdec-fill-rate-2xaa - ditto, but with 2x FSAA +swfdec-fill-rate-4xaa - ditto, but with 4x FSAA + +poppler-bug-12266 - A notorious document that is slow to render in poppler, + and suffered a severe regression with the clipping + rework. +poppler-record - Experimental traces to exercise the recording surface +poppler-record-ordered +poppler-record-drunkard + +epiphany-20090810 - Downloading a 2 GB file, mainly updating a progress + bar and associated text. +epiphany-webkit-20090810 - Running epiphany using the webkit backend over a + couple of planets and the internal BBC news. + It appears the cairo backend is not very mature... + +gnome-system-monitor-20090821 - A clean cairo version of gnome-system-monitor, + graphing CPU/memory/network activity whilst + reading the news with epiphany. + + +Benchmarks +---------- +The benchmarks are a set of trimmed traces that should run in a reasonable +timeframe (I'm aiming for <10 seconds on a 2GHz Core2 with cairo-image, using +./csi-trace --trim=10). The idea here is that this allows us to quickly +determine a representative metric without running the whole suite -- and is +useful for the casual user. The full traces are kept as they will exercise +corner cases much more thoroughly and are not compromised by the conversion. + +To run the benchmark subset, use cairo-perf-trace benchmark. + +firefox-talos-gfx - The synthetic firefox benchmark (identical to + firefox-talos-gfx-20090702) that exercise the core renderer. +firefox-talos-svg - The synthetic firefox benchmark (identical to + firefox-talos-svg-20090702) that exercise the SVG renderer. + +firefox-planet-gnome - Scrolling the full height of http://planet.gnome.org/ + +firefox-fishtank - A HTML5 canvas demo, courtesy of + http://ie.microsoft.com/testdrive/Performance/FishIETank/Default.html + This is a sprite based animation, and mostly tests the + performance of unaligned, scaled alpha blits. +firefox-fishbowl - A HTML5 canvas demo, courtesy of + http://ie.microsoft.com/testdrive/Performance/fishbowl/Default.html + A slightly more complex fishtank. +firefox-paintball - A HTML5 canvas demo, courtesy of + http://ie.microsoft.com/testdrive/Performance/Paintball/Default.html + +firefox-particles - A HTML5 canvas demo, courtesy of + http://ie.microsoft.com/testdrive/Performance/ParticleAccelration +firefox-chalkboard - Another HT|ML5 canvas demo written by Microsoft to + demonstrate their own virtues by highlighting poor + performance elsewhere. + http://ie.microsoft.com/testdrive/Performance/Chalkboard +firefox-canvas - A pair of synthetic canvas benchmarks, found in the wild +firefox-canvas-alpha at http://flashcanvas.net/examples/dl.dropbox.com/u/1865210/mindcat/canvas_perf.html + +firefox-asteroids - A HTML5 game benchmark, + http://www.kevs3d.co.uk/dev/asteroidsbench/ +firefox-scrolling - A bug report concerning an ancient performance regression + http://home.arcor.de/bazonbloch/scrolltest/whyisscrollingonlinuxslowerthanonwindows.htm + +gvim - Scrolling within a window showing a UTF-8 document +gnome-terminal-vim - The same test but using vim inside a gnome-terminal, + but repeated more often to give a comparable time. + +evolution - based on full/evolution-20090607 +gnome-system-monitor - based on full/gnome-system-monitor-20090821 +midori-zoomed - scroll http://www.jakob-persson.com/styles_demo/?s=5 + whilst zoomed in. +ocitysmap - ocitysmap-render -f png -c Sanguinet +popper - based on full/poppler-20090811 +poppler-reseau - A vector based map of a French city, which is + abnormally slow in cairo: + https://bugs.freedesktop.org/show_bug.cgi?id=38927 +swfdec-giant-steps - based on full/swfdec-giant-steps +swfdec-youtube - based on full/swfdec-youtube +xfce4-terminal-a1 - scrolling 'man gcc' using the terminus font + +grads-heat-map - provided by Jennifer Adams, a typical output from + GraDS, an open-source program for the analsyis and + display of meteorlogical data. The trace is heavy in + unantialiased fills and strokes. + +chromium-tabs - provided by Jindrich Makovicka to exercise an issue + he found will switching between tabs in Chromium, where + the xlib backend on his machine was over 200x slower + than the image backend. diff --git a/csi-bind.c b/csi-bind.c new file mode 100644 index 0000000..8811e63 --- /dev/null +++ b/csi-bind.c @@ -0,0 +1,19 @@ +#include <cairo.h> +#include <cairo-script-interpreter.h> + +#include <stdio.h> + +static cairo_status_t +write (void *closure, const unsigned char *data, unsigned int length) +{ + if (fwrite (data, length, 1, closure) != 1) + return CAIRO_STATUS_WRITE_ERROR; + + return CAIRO_STATUS_SUCCESS; +} + +int +main (void) +{ + return cairo_script_interpreter_translate_stream (stdin, write, stdout); +} diff --git a/csi-trace.c b/csi-trace.c new file mode 100644 index 0000000..ea4f1e9 --- /dev/null +++ b/csi-trace.c @@ -0,0 +1,96 @@ +#include <cairo-script.h> +#include <cairo-script-interpreter.h> + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <setjmp.h> +#include <time.h> + +static jmp_buf jmp; +static time_t timeout; + +static cairo_format_t +format_from_content (cairo_content_t content) +{ + switch (content) { + case CAIRO_CONTENT_ALPHA: return CAIRO_FORMAT_A8; + case CAIRO_CONTENT_COLOR: return CAIRO_FORMAT_RGB24; + default: + case CAIRO_CONTENT_COLOR_ALPHA: return CAIRO_FORMAT_ARGB32; + } +} + +static cairo_surface_t * +_script_surface_create (void *closure, + cairo_content_t content, + double width, double height, + long uid) +{ + cairo_surface_t *surface, *image; + cairo_rectangle_t extents; + + /* use a image target so that we can use this surface as a source */ + image = cairo_image_surface_create (format_from_content (content), + ceil (width), ceil (height)); + surface = cairo_script_surface_create_for_target (closure, image); + cairo_surface_destroy (image); + + return surface; +} + +static cairo_t * +_script_context_create (void *closure, + cairo_surface_t *surface) +{ + if (timeout && time (NULL) > timeout) + longjmp (jmp, 1); + + return cairo_create (surface); +} + +static cairo_status_t +write (void *closure, const unsigned char *data, unsigned int length) +{ + if (fwrite (data, length, 1, closure) != 1) + return CAIRO_STATUS_WRITE_ERROR; + + return CAIRO_STATUS_SUCCESS; +} + +int +main (int argc, char **argv) +{ + const cairo_script_interpreter_hooks_t hooks = { + .closure = cairo_script_create_for_stream (write, stdout), + .surface_create = _script_surface_create, + .context_create = _script_context_create, + }; + cairo_script_interpreter_t *csi; + int i; + + for (i = 1; i < argc; i++) { + if (strcmp (argv[i], "--trim") == 0) { + timeout = atoi (argv[i+1]); + i++; + } else if (strncmp (argv[i], "--trim=", 7) == 0) { + timeout = atoi (argv[i] + 7); + } else if (strcmp (argv[i], "--version")) { + printf ("%s: version %s\n", argv[0], __DATE__); + exit (0); + } else if (strcmp (argv[i], "--help")) { + printf ("usage: %s [--trim=max.seconds] < in > out\n", argv[0]); + exit (0); + } + } + + if (timeout) + timeout += time (NULL); + + csi = cairo_script_interpreter_create (); + cairo_script_interpreter_install_hooks (csi, &hooks); + if (setjmp (jmp) == 0) + cairo_script_interpreter_feed_stream (csi, stdin); + cairo_device_destroy (hooks.closure); + return cairo_script_interpreter_destroy (csi); +} |