summaryrefslogtreecommitdiff
path: root/perf/cairo-perf-diff
diff options
context:
space:
mode:
authorMathias Hasselmann <mathias.hasselmann@gmx.de>2007-03-14 21:18:09 +0100
committerMathias Hasselmann <mathias.hasselmann@gmx.de>2007-03-14 21:18:09 +0100
commitf1dd48475a34a038ebdb6426b04fc3728a0f0782 (patch)
tree28d3d656931ea309f61970146780c1c86eb676f5 /perf/cairo-perf-diff
parenta7595c1295ba1a58b452b1df31d02776e5c17c0f (diff)
downloadcairo-f1dd48475a34a038ebdb6426b04fc3728a0f0782.tar.gz
Improve CPU utilization when building cairo-perf
Diffstat (limited to 'perf/cairo-perf-diff')
-rwxr-xr-xperf/cairo-perf-diff11
1 files changed, 11 insertions, 0 deletions
diff --git a/perf/cairo-perf-diff b/perf/cairo-perf-diff
index f87391732..4462084de 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