# Running 'make' in this directory runs the tests.
# Some parameters can be tweaked, e.g.
#
#  make RATE=10  SIZE=400x400 
#
# Existing measurements are recorded in the file "speeds".
# If you make new measurements, let us know!
# Mail your results to software@geom.umn.edu.
#
# Geomview is available under ftp://geom.umn.edu/pub/software/geomview/
# or see the web pages at http://www.geom.umn.edu/software/geomview/

SHELL = /bin/sh

GEOMVIEW = geomview	# Program to run
DURATION = 20		# Test duration in seconds

# Report every ${RATE} steps.  Could use e.g. RATE = 20 on machines with
# fast graphics, to avoid printing numerous messages.
RATE = 10

# Window size in pixels
SIZE = 200x200

# The rawevent calls below are equivalent to typing "vs"; on SGI's,
# this puts the display in single-buffered mode, where possible.
# This prevents the frame rate from being limited by the screen refresh speed,
# since (on SGI's) buffer-switching in double-buffered mode is forced to wait
# for the next vertical retrace.

SINGLEBUFFER = (rawevent 118 0 0 0 0) (rawevent 115 0 0 0 0)
SETUP = "${SINGLEBUFFER} (transform-incr g0 g0 g0  rotate 0 6.28318 0 15)"

FINISH = "(sleep-for ${DURATION}) (exit)"

all:   intro polygon  matrix  tmesh

intro:
	@echo "Three tests follow.  Estimate speeds for each one by watching"
	@echo "the 'mean' column of the timing messages.  Watch for the times"
	@echo "to approach a constant value, ignoring any startup transient."
	@echo "Note: the computer should be idle while running this test."
	@echo "Conditions: ${SIZE} pixel window, reporting every ${RATE} frames."

polygon matrix tmesh:
	@REPORT=`awk 'BEGIN { N = ${RATE}; \
		for(i=0;i<10;i++) ord[i ""] = i+48; \
		for(i=1; i<=length(N); i++) \
		  print "(rawevent " ord[substr(N,i,1)] " 0 0 0 0)"; \
		print "(rawevent 20 0 0 0 0)"; \
		exit; }'`; \
	 echo "---- Running $@ test ---"; \
	 echo ${SETUP} "$${REPORT}" ${FINISH} | \
		${GEOMVIEW} -wpos ${SIZE}@200,200 -c - $@.oogl

geomview-speedtests.tar.Z: _always
	rm -f $@
	tar cf - Makefile speeds polygon.oogl matrix.oogl tmesh.oogl | \
		compress > $@

tar:	geomview-speedtests.tar.Z

_always:
