[cairo-commit] 4 commits - perf/cairo-perf-diff perf/cairo-perf-diff-files.c

Carl Worth cworth at kemper.freedesktop.org
Fri Nov 10 11:26:38 PST 2006


 perf/cairo-perf-diff         |   73 ++++++++++++++++++++++++++++++++-----------
 perf/cairo-perf-diff-files.c |    3 +
 2 files changed, 57 insertions(+), 19 deletions(-)

New commits:
diff-tree 26b74049e79a6137e8556e1b3e5c3aedd780abb0 (from f1f189b81a24730b7c5b5761165ab30bb8310bca)
Author: Carl Worth <cworth at cworth.org>
Date:   Fri Nov 10 10:31:14 2006 -0800

    cairo-perf-diff: Use rsync instead of cp to avoid some unnecessary rebuilding

diff --git a/perf/cairo-perf-diff b/perf/cairo-perf-diff
index a50fe14..0ef32eb 100755
--- a/perf/cairo-perf-diff
+++ b/perf/cairo-perf-diff
@@ -127,9 +127,9 @@ run_cairo_perf_if_not_cached() {
     git checkout tmp-cairo-perf-diff
     git reset --hard $sha
     make CFLAGS="-O2" || (rm config.cache && make CFLAGS="-O2")
-    cp -a $CAIRO_DIR/boilerplate .
+    rsync -rl $CAIRO_DIR/boilerplate .
     (cd boilerplate; make)
-    cp -a $CAIRO_DIR/perf .
+    rsync -rl $CAIRO_DIR/perf .
     cd perf;
     make || exit 1
     echo "Running \"cairo-perf $CAIRO_PERF_OPTIONS\" against $rev. Results will be cached in:"
diff-tree f1f189b81a24730b7c5b5761165ab30bb8310bca (from d9b697c46ceb4849436df162d0574b08856680bb)
Author: Carl Worth <cworth at cworth.org>
Date:   Fri Nov 10 10:20:49 2006 -0800

    cairo-perf-diff: Separate old and new build directories
    
    With the fancy new, incremental cairo-perf-diff we don't want to keep
    resetting the same working tree back and forth between the old and new
    versions and rebuilding everything all over again. So use two different
    build directories instead of one.
    
    This fixes the rebuild of the library itself, but the perf stuff is still
    being rebuilt, (since it's being re-copied each time).

diff --git a/perf/cairo-perf-diff b/perf/cairo-perf-diff
index c8b2086..a50fe14 100755
--- a/perf/cairo-perf-diff
+++ b/perf/cairo-perf-diff
@@ -97,9 +97,14 @@ rev2perf() {
     echo "$CAIRO_PERF_DIR/${perf_tree_sha}-${src_tree_sha}.perf"
 }
 
-# Usage: run_cairo_perf_if_not_cached <rev>
+# Usage: run_cairo_perf_if_not_cached <rev> <suffix>
+# The <rev> argument must be a valid git ref-spec that can
+# be resolved to a commit. The suffix is just something
+# unique so that build directories can be separated for
+# multiple calls to this function.
 run_cairo_perf_if_not_cached() {
     rev=$1
+    build_dir="build-$2"
 
     owd=$(pwd)
     sha=$(rev2sha $rev)
@@ -113,11 +118,11 @@ run_cairo_perf_if_not_cached() {
     fi
     cd $CAIRO_PERF_DIR
 
-    if [ ! -d build ]; then
-	git clone -s $CAIRO_DIR build
-	(cd build; git checkout -b tmp-cairo-perf-diff $sha; CFLAGS="-O2" ./autogen.sh)
+    if [ ! -d $build_dir ]; then
+	git clone -s $CAIRO_DIR $build_dir
+	(cd $build_dir; git checkout -b tmp-cairo-perf-diff $sha; CFLAGS="-O2" ./autogen.sh)
     fi
-    cd build
+    cd $build_dir
 
     git checkout tmp-cairo-perf-diff
     git reset --hard $sha
@@ -135,13 +140,13 @@ run_cairo_perf_if_not_cached() {
 
 if [ ! -e $old ]; then
     git_setup
-    run_cairo_perf_if_not_cached $old
+    run_cairo_perf_if_not_cached $old old
     old=$(rev2perf $old)
 fi
 
 if [ ! -e $new ]; then
     git_setup
-    run_cairo_perf_if_not_cached $new
+    run_cairo_perf_if_not_cached $new new
     new=$(rev2perf $new)
 fi
 
diff-tree d9b697c46ceb4849436df162d0574b08856680bb (from 439bf81e56955ea543a890d5e89622745598c8ea)
Author: Carl Worth <cworth at cworth.org>
Date:   Fri Nov 10 10:04:01 2006 -0800

    cairo-perf-diff: Allow incremental refinement of performance results
    
    cairo-perf-diff now accepts a -f command-line option to force it to
    re-generate performance results even if something exists in the cache
    already. It also now uses raw mode and appends to the cached file
    rather than rewriting the results.
    
    Finally, it also now allows a -- option on the command line and passes
    all the subsequent command-line options to cairo-perf. This is handy for
    limiting cairo-perf to run only on a subset of the tests of interest.

diff --git a/perf/cairo-perf-diff b/perf/cairo-perf-diff
index b1e5458..c8b2086 100755
--- a/perf/cairo-perf-diff
+++ b/perf/cairo-perf-diff
@@ -10,8 +10,8 @@ usage() {
     echo "" >&2
     echo "For comparing (cached) performance of revisions:" >&2
     echo "" >&2
-    echo "	$argv0 <revision>" >&2
-    echo "	$argv0 <rev1> <rev2>" >&2
+    echo "	$argv0 [-f] <revision> [-- cairo-perf options]" >&2
+    echo "	$argv0 [-f] <rev1> <rev2> [-- cairo-perf-options]" >&2
     echo "" >&2
     echo "If given a single revision, compares its results to that of its" >&2
     echo "(first-parent) predecessor. Otherwise compares the two given revisions." >&2
@@ -20,18 +20,48 @@ usage() {
     echo "	$argv0 HEAD		# Show impact of latest commit" >&2
     echo "	$argv0 1.2.0 1.2.4	# Compare performance of 1.2.0 to 1.2.4" >&2
     echo "" >&2
+    echo "The -f option forces cairo-perf-diff to re-run performance tests even" >&2
+    echo "if cached performance data is available." >&2
+    echo "" >&2
+    echo "Additional options can be passed the child cairo-perf process" >&2
+    echo "by separating them with a double hyphen (--). For example, to" >&2
+    echo "examine what the impact of the latest change is on the stroke" >&2
+    echo "test you might use:" >&2
+    echo "" >&2
+    echo "	$argv0 HEAD -- stroke" >&2
+    echo "" >&2
     echo "The performance results are cached in .perf next to the .git directory." >&2
     exit 1
 }
 
-if [ $# -eq 1 ]; then
+# Yes, this ugly ad-hoc option parsing could be cleaned up
+if [ $# -eq 0 ] || [ "$1" = "--" ]; then
+    usage
+fi
+
+if [ "$1" = "-f" ]; then
+    force_cairo_perf="true"
+    shift 1
+fi
+
+if [ $# -eq 1 ] || [ "$2" = "--" ]; then
     old="$1^"
     new="$1"
-elif [ $# -eq 2 ]; then
+    shift 1
+else
     old="$1"
     new="$2"
-else
-    usage
+    shift 2
+fi
+
+CAIRO_PERF_OPTIONS="-r -i 10"
+if [ $# -gt 0 ]; then
+    if [ "$1" = "--" ]; then
+	shift 1
+	CAIRO_PERF_OPTIONS="$CAIRO_PERF_OPTIONS $@"
+    else
+	usage
+    fi
 fi
 
 git_setup() {
@@ -74,7 +104,7 @@ run_cairo_perf_if_not_cached() {
     owd=$(pwd)
     sha=$(rev2sha $rev)
     perf=$(rev2perf $rev)
-    if [ -e $perf ]; then
+    if [ -e $perf ] && [ "$force_cairo_perf" != "true" ]; then
 	return 0
     fi
     if [ ! -d $CAIRO_PERF_DIR ]; then
@@ -97,7 +127,9 @@ run_cairo_perf_if_not_cached() {
     cp -a $CAIRO_DIR/perf .
     cd perf;
     make || exit 1
-    (make perf || echo "*** Performance test crashed") > $perf
+    echo "Running \"cairo-perf $CAIRO_PERF_OPTIONS\" against $rev. Results will be cached in:"
+    echo "$perf"
+    (./cairo-perf $CAIRO_PERF_OPTIONS || echo "*** Performance test crashed") >> $perf
     cd $owd
 }
 
@@ -113,4 +145,4 @@ if [ ! -e $new ]; then
     new=$(rev2perf $new)
 fi
 
-cairo-perf-diff-files $old $new
+$CAIRO_DIR/perf/cairo-perf-diff-files $old $new
diff-tree 439bf81e56955ea543a890d5e89622745598c8ea (from f6b400a292759a7d603843afa6030ebb01349855)
Author: Carl Worth <cworth at cworth.org>
Date:   Fri Nov 10 10:00:31 2006 -0800

    Fix broken size calculation for xrealloc
    
    Another one of those "untested code == broken code" situations.

diff --git a/perf/cairo-perf-diff-files.c b/perf/cairo-perf-diff-files.c
index b4d9dc2..520ba35 100644
--- a/perf/cairo-perf-diff-files.c
+++ b/perf/cairo-perf-diff-files.c
@@ -359,7 +359,8 @@ cairo_perf_report_sort_and_compute_stats
 		    new_samples_count += t->samples_count;
 		if (new_samples_count > base->samples_size) {
 		    base->samples_size = new_samples_count;
-		    base->samples = xrealloc (base->samples, base->samples_size);
+		    base->samples = xrealloc (base->samples,
+					      base->samples_size * sizeof (cairo_perf_ticks_t));
 		}
 		for (t = base + 1; t < next; t++) {
 		    memcpy (&base->samples[base->samples_count], t->samples,


More information about the cairo-commit mailing list