[PATCH v2 app-x11perf] config: use Autoconf rather than sed to substitute $libdir

Gaetan Nadon memsize at videotron.ca
Fri Jan 21 18:27:33 PST 2011


The path substitution in x11perfcomp script can be done at configuration
time using Autoconf. This is an alternative to using sed and requires
less Makefile work.

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
	Change: don't clean x11perfcomp generated script now that it is done at config time.

 Makefile.am    |   13 +------
 configure.ac   |    6 +++-
 x11pcomp.cpp   |  103 ------------------------------------------------------
 x11perfcomp.in |  105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 111 insertions(+), 116 deletions(-)
 delete mode 100644 x11pcomp.cpp
 create mode 100644 x11perfcomp.in

diff --git a/Makefile.am b/Makefile.am
index 3b6d13b..f67bec3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,13 +20,9 @@
 #  PERFORMANCE OF THIS SOFTWARE.
 
 SUBDIRS = man
-bin_PROGRAMS = x11perf
 
+bin_PROGRAMS = x11perf
 bin_SCRIPTS = x11perfcomp
-
-LIBPATH = $(libdir)/X11/x11perfcomp
-
-x11perfcompdir = $(LIBPATH)
 dist_x11perfcomp_SCRIPTS = fillblnk perfboth perfratio Xmark
 
 AM_CFLAGS = $(CWARNFLAGS) $(XEXT_CFLAGS) $(XFT_CFLAGS) $(XRENDER_CFLAGS) $(X11PERF_CFLAGS)
@@ -53,13 +49,6 @@ x11perf_SOURCES =	\
         x11perf.c \
         x11perf.h
 
-x11perfcomp: x11pcomp.cpp
-	$(AM_V_GEN)$(SED) s/LIBPATH/`echo $(LIBPATH) | sed -e s/\\\\//\\\\\\\\\\\\\//g`/ < $(srcdir)/x11pcomp.cpp | \
-		$(SED) s/XCOMM/\#/ > $@
-
-CLEANFILES = $(bin_SCRIPTS) x11perfcomp
-EXTRA_DIST = x11pcomp.cpp
-
 MAINTAINERCLEANFILES = ChangeLog INSTALL
 
 .PHONY: ChangeLog INSTALL
diff --git a/configure.ac b/configure.ac
index 96126f2..79e4bfc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,6 +41,9 @@ XORG_DEFAULT_OPTIONS
 
 AC_TYPE_SIGNAL
 
+# Define the installation directory for the x11 performance compare scripts
+AC_SUBST([x11perfcompdir], [$libdir/X11/x11perfcomp])
+
 # Checks for pkg-config packages
 PKG_CHECK_MODULES(X11PERF, x11 xmuu)
 
@@ -74,5 +77,6 @@ esac
 
 AC_CONFIG_FILES([
 	Makefile
-	man/Makefile])
+	man/Makefile
+	x11perfcomp])
 AC_OUTPUT
diff --git a/x11pcomp.cpp b/x11pcomp.cpp
deleted file mode 100644
index be7d397..0000000
--- a/x11pcomp.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-XCOMM! /bin/sh
-XCOMM
-XCOMM $XFree86$
-XCOMM
-XCOMM Collects multiple outputs of x11perf.  Just feed it a list of files, each
-XCOMM containing the output from an x11perf run, and this shell will extract the
-XCOMM object/second information and show it in tabular form.  An 80-column line
-XCOMM is big enough to compare 4 different servers.
-XCOMM
-XCOMM This script normally uses the results from $1 to extract the test label
-XCOMM descriptions, so you can run x11perf on a subset of the test and then
-XCOMM compare the results.  But note that x11perffill requires the labels file
-XCOMM to be a superset of the x11perf results file.  If you run into an ugly
-XCOMM situation in which none of the servers completes the desired tests 
-XCOMM (quite possible on non-DEC servers :), you can use -l <filename> as $1 and
-XCOMM $2 to force x11perfcomp to use the labels stored in file $2.  (You can run
-XCOMM x11perf with the -labels option to generate such a file.)
-XCOMM
-XCOMM Mark Moraes, University of Toronto <moraes at csri.toronto.edu>
-XCOMM Joel McCormack, DEC Western Research Lab <joel at decwrl.dec.com>
-XCOMM
-
-PATH=LIBPATH:.:$PATH
-export PATH
-
-set -e
-tmp=${TMPDIR-/tmp}/rates.$$
-trap "rm -rf $tmp" 0 1 2 15
-mkdir $tmp || exit 1
-mkdir $tmp/rates
-ratio=
-allfiles=
-XCOMM Include relative rates in output?  Report only relative rates?
-case $1 in
--r|-a)
-	ratio=1
-	shift;
-	;;
--ro)
-	ratio=2
-	shift;
-	;;
-esac
-XCOMM Get either the provided label file, or construct one from all the
-XCOMM files given.
-case $1 in
--l)	cp $2 $tmp/labels
-	shift; shift
-	;;
-*)	for file in "$@"; do
-		awk '$2 == "reps" || $2 == "trep" { print $0; next; }' $file |
- 		sed 's/^.*: //' |
- 		sed 's/ /_/g' |
- 		awk 'NR > 1 	{ printf ("%s %s\n", prev, $0); } \
-				{ prev = $0; }'
-	done | tsort 2>/dev/null | sed 's/_/ /g' > $tmp/labels
-	;;
-esac
-XCOMM Go through all files, and create a corresponding rate file for each
-n=1
-for i
-do
-XCOMM Get lines with average numbers, fill in any tests that may be missing
-XCOMM then extract the rate field
-	base=`basename $i`
-	(echo "     $n  "
-	 echo '--------'
-	 awk '$2 == "reps" || $2 == "trep" { \
-		line = $0; \
-		next; \
-	    } \
-	    NF == 0 && line != "" { \
-		print line; \
-		line=""; \
-		next; \
-	    } \
-	 ' $i > $tmp/$n.avg
-	 fillblnk $tmp/$n.avg $tmp/labels |
-	 sed 's/( *\([0-9]*\)/(\1/'   |
-	 awk '$2 == "reps" || $2 == "trep" { \
-	 					n = substr($6,2,length($6)-7); \
-						printf "%8s\n", n; \
-    	 				   }'
-	) > $tmp/rates/$n
-	echo "$n: $i"
-	allfiles="$allfiles$tmp/rates/$n "
-	n=`expr $n + 1`
-done
-case x$ratio in
-x)
-	ratio=/bin/cat
-	;;
-x1)
-	ratio="perfboth $n"
-	;;
-*)
-	ratio="perfratio $n"
-	;;
-esac
-echo ''
-(echo Operation; echo '---------'; cat $tmp/labels) |
-paste $allfiles - | sed 's/	/  /g' | $ratio
-rm -rf $tmp
diff --git a/x11perfcomp.in b/x11perfcomp.in
new file mode 100644
index 0000000..cab0452
--- /dev/null
+++ b/x11perfcomp.in
@@ -0,0 +1,105 @@
+#! /bin/sh
+#
+# $XFree86$
+#
+# Collects multiple outputs of x11perf.  Just feed it a list of files, each
+# containing the output from an x11perf run, and this shell will extract the
+# object/second information and show it in tabular form.  An 80-column line
+# is big enough to compare 4 different servers.
+#
+# This script normally uses the results from $1 to extract the test label
+# descriptions, so you can run x11perf on a subset of the test and then
+# compare the results.  But note that x11perffill requires the labels file
+# to be a superset of the x11perf results file.  If you run into an ugly
+# situation in which none of the servers completes the desired tests
+# (quite possible on non-DEC servers :), you can use -l <filename> as $1 and
+# $2 to force x11perfcomp to use the labels stored in file $2.  (You can run
+# x11perf with the -labels option to generate such a file.)
+#
+# Mark Moraes, University of Toronto <moraes at csri.toronto.edu>
+# Joel McCormack, DEC Western Research Lab <joel at decwrl.dec.com>
+#
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+PATH=@x11perfcompdir@:.:$PATH
+export PATH
+
+set -e
+tmp=${TMPDIR-/tmp}/rates.$$
+trap "rm -rf $tmp" 0 1 2 15
+mkdir $tmp || exit 1
+mkdir $tmp/rates
+ratio=
+allfiles=
+# Include relative rates in output?  Report only relative rates?
+case $1 in
+-r|-a)
+	ratio=1
+	shift;
+	;;
+-ro)
+	ratio=2
+	shift;
+	;;
+esac
+# Get either the provided label file, or construct one from all the
+# files given.
+case $1 in
+-l)	cp $2 $tmp/labels
+	shift; shift
+	;;
+*)	for file in "$@"; do
+		awk '$2 == "reps" || $2 == "trep" { print $0; next; }' $file |
+		sed 's/^.*: //' |
+		sed 's/ /_/g' |
+		awk 'NR > 1 	{ printf ("%s %s\n", prev, $0); } \
+				{ prev = $0; }'
+	done | tsort 2>/dev/null | sed 's/_/ /g' > $tmp/labels
+	;;
+esac
+# Go through all files, and create a corresponding rate file for each
+n=1
+for i
+do
+# Get lines with average numbers, fill in any tests that may be missing
+# then extract the rate field
+	base=`basename $i`
+	(echo "     $n  "
+	 echo '--------'
+	 awk '$2 == "reps" || $2 == "trep" { \
+		line = $0; \
+		next; \
+	    } \
+	    NF == 0 && line != "" { \
+		print line; \
+		line=""; \
+		next; \
+	    } \
+	 ' $i > $tmp/$n.avg
+	 fillblnk $tmp/$n.avg $tmp/labels |
+	 sed 's/( *\([0-9]*\)/(\1/'   |
+	 awk '$2 == "reps" || $2 == "trep" { \
+						n = substr($6,2,length($6)-7); \
+						printf "%8s\n", n; \
+					   }'
+	) > $tmp/rates/$n
+	echo "$n: $i"
+	allfiles="$allfiles$tmp/rates/$n "
+	n=`expr $n + 1`
+done
+case x$ratio in
+x)
+	ratio=/bin/cat
+	;;
+x1)
+	ratio="perfboth $n"
+	;;
+*)
+	ratio="perfratio $n"
+	;;
+esac
+echo ''
+(echo Operation; echo '---------'; cat $tmp/labels) |
+paste $allfiles - | sed 's/	/  /g' | $ratio
+rm -rf $tmp
-- 
1.6.0.4



More information about the xorg-devel mailing list