[m-dev.] for review: benchmark timing code

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Feb 27 19:38:18 AEDT 2001


Estimated hours taken: 1

Add some code for running timing tests on the
programs in the tests/benchmarks directory.

tests/benchmarks/Mmakefile:
	Add new target `times'.

tests/benchmarks/BenchEntry:
tests/benchmarks/BenchEntry.hlc:
	New files, for use by the `times' target in the Mmakefile.
	These two files contain the names of the non-I/O entry points
	for the various benchmarks, for LLDS and MLDS grades respectively.

tests/benchmarks/BenchRepeatCounts:
	New file.  The contents of this file specify how many times
	to repeat each benchmark.

tests/benchmarks/repeat_time:
	New file, for use by the `times' target in the Mmakefile.
	This is a tiny (t)csh script for running a command repeatedly
	and timing how long it takes.

Workspace: /mnt/venus/home/venus/fjh/ws-venus2/mercury
Index: tests/benchmarks/BenchEntry
===================================================================
RCS file: BenchEntry
diff -N BenchEntry
--- /dev/null	Thu Mar 30 14:06:13 2000
+++ BenchEntry	Tue Feb 27 19:25:08 2001
@@ -0,0 +1,11 @@
+cqueens	mercury__cqueens__main1_1_0
+crypt	mercury__crypt__main1_1_0
+deriv	mercury__deriv__main4_4_0
+deriv2	mercury__deriv2__main4_4_0
+nrev	mercury__nrev__main1_1_0
+poly	mercury__poly__main1_1_0
+primes	mercury__primes__main1_1_0
+qsort	mercury__qsort__main1_1_0
+queens	mercury__queens__main1_1_0
+query	mercury__query__main1_1_0
+tak	mercury__tak__main1_1_0
Index: tests/benchmarks/BenchEntry.hlc
===================================================================
RCS file: BenchEntry.hlc
diff -N BenchEntry.hlc
--- /dev/null	Thu Mar 30 14:06:13 2000
+++ BenchEntry.hlc	Tue Feb 27 19:25:27 2001
@@ -0,0 +1,11 @@
+cqueens	cqueens__main1_1_p_0
+crypt	crypt__main1_1_p_0
+deriv	deriv__main4_4_p_0
+deriv2	deriv2__main4_4_p_0
+nrev	nrev__main1_1_p_0
+poly	poly__main1_1_p_0
+primes	primes__main1_1_p_0
+qsort	qsort__main1_1_p_0
+queens	queens__main1_1_p_0
+query	query__main1_1_p_0
+tak	tak__main1_1_p_0
Index: tests/benchmarks/BenchRepeatCounts
===================================================================
RCS file: BenchRepeatCounts
diff -N BenchRepeatCounts
--- /dev/null	Thu Mar 30 14:06:13 2000
+++ BenchRepeatCounts	Tue Feb 27 19:24:19 2001
@@ -0,0 +1,11 @@
+queens	500
+cqueens	35000
+crypt	20000
+deriv	70000
+deriv2	70000
+nrev	20000
+poly	1200
+primes	30000
+qsort	100000
+query	600000
+tak	900
Index: tests/benchmarks/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/benchmarks/Mmakefile,v
retrieving revision 1.2
diff -u -d -r1.2 Mmakefile
--- tests/benchmarks/Mmakefile	2000/04/05 06:11:27	1.2
+++ tests/benchmarks/Mmakefile	2001/02/27 08:34:20
@@ -7,10 +7,9 @@
 
 #-----------------------------------------------------------------------------#
 
-# uncomment the following lines to test the performance
+# uncomment the following line to test the performance
 # of the benchmarks (with I/O suppressed)
 # C2INITFLAGS=-w "`extract $(*:_init=) '' BenchEntry`"
-# MLFLAGS=-- -static
 
 #-----------------------------------------------------------------------------#
 
@@ -41,6 +40,7 @@
 RESS=	$(PROGS:%=%.res)
 SS=	$(PROGS:%=%.s)
 CS=	$(PROGS:%=%.c)
+TIMES=	$(PROGS:%=%.time)
 
 dep:	$(DEPS)
 
@@ -58,9 +58,19 @@
 
 all:	$(PROGS)
 
+times:	$(TIMES)
+
 dir.%:	$(PROGS) $(SS)
 	-mkdir $@
 	cp $(PROGS) $(SS) $@
 	cp BenchEntry $@
+
+clean_exes:	
+	rm -f $(PROGS)
+
+%.time: %
+	{ count=`awk '/$*/ { print $$2; exit; }' < BenchRepeatCounts`; \
+	echo "$$count	"; \
+	MERCURY_OPTIONS="-t -r$$count" ./repeat_time 3 ./$*; } 2>&1 | tee $@
 
 #-----------------------------------------------------------------------------#
Index: tests/benchmarks/repeat_time
===================================================================
RCS file: repeat_time
diff -N repeat_time
--- /dev/null	Thu Mar 30 14:06:13 2000
+++ repeat_time	Tue Feb 27 19:30:20 2001
@@ -0,0 +1,6 @@
+#!/bin/csh -f
+#!/usr/bin/csh -f
+#!/usr/local/bin/tcsh -f
+set count=$argv[1]
+shift
+repeat $count time $argv:q

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list