[cairo-commit] 4 commits - perf/cairo-perf-diff perf/.gitignore perf/Makefile.am perf/make-html.py

Mathias Hasselmann hasselmm at kemper.freedesktop.org
Wed Mar 14 13:58:44 PDT 2007


 perf/.gitignore      |    1 
 perf/Makefile.am     |    8 ++++
 perf/cairo-perf-diff |   34 ++++++++++++++++---
 perf/make-html.py    |   89 +++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 125 insertions(+), 7 deletions(-)

New commits:
diff-tree e878f2259b2512f0411d698bf078fe91b7373246 (from 1a3f5df5ff4a80bb199e296491e3a5c9887fd4f7)
Author: Mathias Hasselmann <mathias.hasselmann at gmx.de>
Date:   Wed Mar 14 11:42:41 2007 +0100

    Include pixman/src in cairo-perf hash

diff --git a/perf/cairo-perf-diff b/perf/cairo-perf-diff
index b6222d5..ad3d44c 100755
--- a/perf/cairo-perf-diff
+++ b/perf/cairo-perf-diff
@@ -107,8 +107,9 @@ cpu_count() {
 rev2perf() {
     rev=$1
     src_tree_sha=$(rev2sha $rev:src)
+    pxm_tree_sha=$(rev2sha $rev:pixman/src)
     perf_tree_sha=$(rev2sha HEAD:perf)
-    echo "$CAIRO_PERF_DIR/${perf_tree_sha}-${src_tree_sha}.perf"
+    echo "$CAIRO_PERF_DIR/${perf_tree_sha}-${src_tree_sha}-${pxm_tree_sha}.perf"
 }
 
 # Usage: run_cairo_perf_if_not_cached <rev> <suffix>
diff-tree 1a3f5df5ff4a80bb199e296491e3a5c9887fd4f7 (from c40be43aef735deba7605fde14300b7810701011)
Author: Mathias Hasselmann <mathias.hasselmann at gmx.de>
Date:   Wed Mar 14 21:42:50 2007 +0100

    Add index.html to .gitignore

diff --git a/perf/.gitignore b/perf/.gitignore
index 53d720c..eaa2b2e 100644
--- a/perf/.gitignore
+++ b/perf/.gitignore
@@ -1,5 +1,6 @@
 cairo-perf
 cairo-perf-diff-files
+index.html
 *.o
 *.exe
 *.manifest
diff-tree c40be43aef735deba7605fde14300b7810701011 (from f1dd48475a34a038ebdb6426b04fc3728a0f0782)
Author: Mathias Hasselmann <mathias.hasselmann at gmx.de>
Date:   Wed Mar 14 21:41:40 2007 +0100

    Transform the output of cairo-perf-diff into HTML

diff --git a/perf/Makefile.am b/perf/Makefile.am
index cef6431..8fd6e64 100644
--- a/perf/Makefile.am
+++ b/perf/Makefile.am
@@ -60,6 +60,11 @@ $(top_builddir)/src/libcairo.la:
 perf: cairo-perf FORCE
 	./cairo-perf
 
+html: index.html
+
+index.html: cairo-perf
+	./cairo-perf-diff -h HEAD > $@
+
 EXTRA_VG_FLAGS = $(CAIRO_EXTRA_VALGRIND_FLAGS)
 VG_MEMCHECK_FLAGS = \
 	--tool=memcheck \
@@ -68,7 +73,8 @@ VG_MEMCHECK_FLAGS = \
 VG_CALLGRIND_FLAGS = \
 	--tool=callgrind
 CLEANFILES = \
-	valgrind-log
+	valgrind-log \
+	index.html
 
 perf-valgrind: cairo-perf FORCE
 	$(top_srcdir)/libtool --mode=execute \
diff --git a/perf/cairo-perf-diff b/perf/cairo-perf-diff
index 4462084..b6222d5 100755
--- a/perf/cairo-perf-diff
+++ b/perf/cairo-perf-diff
@@ -42,10 +42,15 @@ if [ $# -eq 0 ] || [ "$1" = "--" ]; then
     usage
 fi
 
-if [ "$1" = "-f" ]; then
-    force_cairo_perf="true"
-    shift 1
-fi
+while true; do
+    case $1 in
+        -f|--force) force_cairo_perf="true";;
+        -h|--html) html_output="true";;
+        *) break;;
+    esac
+
+    shift
+done
 
 if [ $# -eq 1 ] || [ "$2" = "--" ]; then
     old="$1^"
@@ -175,4 +180,9 @@ if [ ! -e $new ]; then
     new=$(rev2perf $new)
 fi
 
-$CAIRO_DIR/perf/cairo-perf-diff-files $old $new
+if [ "$html_output" != "true" ]; then
+    $CAIRO_DIR/perf/cairo-perf-diff-files $old $new
+else
+    $CAIRO_DIR/perf/cairo-perf-diff-files $old $new |
+    $CAIRO_DIR/perf/make-html.py
+fi
diff --git a/perf/make-html.py b/perf/make-html.py
new file mode 100755
index 0000000..79a2992
--- /dev/null
+++ b/perf/make-html.py
@@ -0,0 +1,89 @@
+#!/usr/bin/python
+
+from string import strip
+from sys import stdin
+
+targets = {}
+smilies = {'slowdown': '&#9785;' , 'speedup': '&#9786;'}
+
+for line in stdin:
+	line = map(strip, filter(None, line.split(' ')))
+
+	if 9 == len(line):
+		target, name = line[0:2]
+		factor, dir = line[-2:]
+
+		name = name.split('-')
+		name, size = '-'.join(name[:-1]), name[-1]
+
+		target_tests = targets.get(target, {})
+		name_tests = target_tests.get(name, {})
+
+		name_tests[int(size)] = (factor, dir)
+		target_tests[name] = name_tests
+		targets[target] = target_tests
+
+print '''\
+<html><head>
+<title>Performance Changes</title>
+<style type="text/css">/*<![CDATA[*/
+    table { border-collapse: collapse; }
+
+    th, td { border: 1px solid silver; padding: 0.2em; }
+    td { text-align: center; }
+    th:first-child { text-align: left; }
+    th { background: #eee; }
+
+ /* those colors also should work for color blinds */
+    td.slowdown { background: #f93; }
+    td.speedup { background: #6f9; }
+/*]]>*/</style>
+</head><body>
+<h1>Performance Changes</h1>'''
+
+targets = targets.items()
+targets.sort(lambda a, b: cmp(a[0], b[0]))
+
+for target, names in targets:
+	sizes = {}
+
+	for tests in names.values():
+		for size in tests.keys():
+			sizes[size] = True	
+
+	sizes = sizes.keys()
+	sizes.sort()
+
+	names = names.items()
+	names.sort(lambda a, b: cmp(a[0], b[0]))
+
+	print '<h2><a name="%s">%s</a></h2>' % (target, target)
+	print '<table><thead><tr><th>&nbsp;</th>'
+
+	for size in sizes:
+		print '<th>%s</th>' % size
+
+	print '</tr></thead><tbody>'
+
+	for name, tests in names:
+		print '<tr><th>%s</th>' % name
+		
+		for size in sizes:
+			result = tests.get(size)
+
+			if result:
+				factor, dir = result
+				print '<td class="%s">%s %s</td>' % (
+					dir, factor, smilies[dir])
+
+			else:
+				print '<td>&nbsp;</td>'
+
+		print '</tr>'
+
+
+	print '</tbody></table>'
+
+print '</body></html>'
+
+
diff-tree f1dd48475a34a038ebdb6426b04fc3728a0f0782 (from a7595c1295ba1a58b452b1df31d02776e5c17c0f)
Author: Mathias Hasselmann <mathias.hasselmann at gmx.de>
Date:   Wed Mar 14 21:18:09 2007 +0100

    Improve CPU utilization when building cairo-perf

diff --git a/perf/cairo-perf-diff b/perf/cairo-perf-diff
index f873917..4462084 100755
--- a/perf/cairo-perf-diff
+++ b/perf/cairo-perf-diff
@@ -82,6 +82,12 @@ rev2sha() {
     git rev-parse --verify $rev || ( echo "Cannot resolve $rev as a git object" && exit 1 )
 }
 
+cpu_count() {
+    test -f /proc/cpuinfo &&
+    grep -c '^processor[[:blank:]]\+:' /proc/cpuinfo ||
+    echo 1
+}
+
 # We cache performance output based on a two-part name capturing the
 # current performance test suite and the library being tested. We
 # capture these as the tree object of the perf directory in HEAD and
@@ -133,6 +139,11 @@ run_cairo_perf_if_not_cached() {
 
     git checkout tmp-cairo-perf-diff
     git reset --hard $sha
+
+    if [ -z "$MAKEFLAGS" ]; then
+        export MAKEFLAGS="-j$(expr $(cpu_count) + 1)"
+    fi
+
     if [ ! -e Makefile ]; then
 	CFLAGS="-O2" ./autogen.sh $CAIRO_AUTOGEN_OPTIONS
     fi


More information about the cairo-commit mailing list