[cairo-commit] csi-bind.c .gitignore Makefile

Chris Wilson ickle at kemper.freedesktop.org
Sat Jul 18 05:33:48 PDT 2009


 .gitignore |    1 +
 Makefile   |    9 ++++++---
 csi-bind.c |   19 +++++++++++++++++++
 3 files changed, 26 insertions(+), 3 deletions(-)

New commits:
commit 304a27b0c5e1fe7a57038991cb3832d8f118738a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Jul 18 13:24:30 2009 +0100

    On decompressing the trace for replay, convert to binary form
    
    There is little benefit from converting to binary format before
    compressing, so we can continue recording in the readable format. This
    has the obvious advantage of not requiring any conversion to read and
    understand a trace.
    
    However as the binary format is sometimes half the size of the textual
    format there is considerable benefit to replaying the binary format. Not
    only is the amount of data read dramatically reduced, the operators are
    already specified in the byte code and so we avoid a couple of lookups
    per operator.
    
    Requires: 23648e2fdfefba4df08bc854d725758209998e1f
    (Obviously a .pc starts to make sense about now...)
    
    For comparison:
       firefox-world-map.trace 526,850,146 bytes
                   bound.trace 275,1877,55 bytes
    
    [ # ]  backend                         test   min(s) median(s) stddev. count
    [  1]     null            firefox-world-map   89.635   89.716   0.19%    3/3
    [  0]     null                        bound   34.481   34.741   0.68%    3/3

diff --git a/.gitignore b/.gitignore
index 3c0b4ad..eee4072 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 *.trace
+csi-bind
 
diff --git a/Makefile b/Makefile
index 66298fe..af411d6 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,10 @@ TRACES := $(LZMA:.lzma=.trace)
 
 all: $(TRACES)
 clean:
-	rm -f $(TRACES)
+	rm -f $(TRACES) csi-bind
 
-%.trace: %.lzma
-	lzma -cd $^ > $@
+%.trace: %.lzma csi-bind
+	lzma -cd $< | ./csi-bind > $@
+
+csi-bind: csi-bind.c
+	$(CC) $^ $(shell pkg-config cairo --cflags --libs) -lcairo-script-interpreter -o $@
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);
+}


More information about the cairo-commit mailing list