# Makefile for lmbench results.
# $Id: Makefile,v 1.3 1994/11/26 00:41:45 lm Exp $
#
# Usage: make [ LIST="aix/* sunos/* ..." ] [ what ]
#
# What to make:
#	print			Prints the results 1 per page.
#	8			Prints the result 8 per page
#	8.ps			Saves the postscript of 8 per page in PS/PS8
#	ps			Saves the postscript of 1 per page in PS/PS
#	x			Previews 1 per page using groff -X
#	summary	[default]	Ascii summary of the results
#	percent			Ascii summary as percentages of the best.
#	list			Print out the current list
#	roff			Print the ascii summaries into a roff file
#
# This Makefile requires groff, gpic, and perl.  You could try it with
# other *roff processors; I have no idea if it works.
#
# There are three sorts of graphical results:
#
# 1. Bargraphs comparing each system in the LIST on the measurements listed
#    in the BG list below (pretty much everything).
# 2. A 2-D graph for each system in LIST, displaying context switch times
#    as a function of (# of processes, size of each process).
# 3. A 2-D graph for each system in LIST, displaying memory read times as
#    a function of (stride size, memory size).
#
# The bargraphs are in a format of my own - the perl script in scripts
# called bargraph takes them as input and produces pic as output.
# It is a pretty straightforward format, you could probably incorparate
# into some Windows spreadsheet if you wanted to.  See tmp/*.bg after
# running make in this directory.
#
# The 2-D graphs are in a format that can (probably) be read by Xgraph.
# I've added a few extensions for titles, etc., that you could just
# take out.  See tmp/mem.* after running a make in this directory.
#
# This Makefile is of marginal usefulness to a site with just one machine.
# I intend to make results available so that people can compare, as well
# as a service where you can compare your results against the "best of
# the breed" for each vendor, as well as against best of the lot.

# List of result files to process.  Defaults to everything.
LIST=	`$(SCRIPTS)getlist`	

# Grrrrr
SHELL=/bin/sh

SCRIPTS=../scripts/

MISC=	tmp/misc_mhz.bg \
	tmp/lat_ctx.bg \
	tmp/lat_ctx8.bg \
	tmp/lat_nullsys.bg \
	tmp/lat_mappings.bg

PROC=	tmp/lat_nullproc.bg \
	tmp/lat_simpleproc.bg \
	tmp/lat_shproc.bg

LATENCY= \
	tmp/lat_pipe.bg \
	tmp/lat_udp_local.bg \
	tmp/lat_rpc_udp_local.bg \
	tmp/lat_tcp_local.bg  \
	tmp/lat_rpc_tcp_local.bg 

BANDWIDTH= \
	tmp/bw_pipe.bg \
	tmp/bw_tcp_local.bg \
	tmp/bw_file.bg \
	tmp/bw_reread.bg \
	tmp/bw_mmap.bg \
	tmp/bw_bcopy_libc.bg \
	tmp/bw_bcopy_unrolled.bg \
	tmp/bw_mem_rdsum.bg \
	tmp/bw_mem_wr.bg

BG=	$(MISC) $(PROC) $(LATENCY) $(BANDWIDTH)

PRINT=groff -p | lpr -h
PS8UP=groff -p | mpage -P -8 -a | $(SCRIPTS)save PS/PS8

summary:
	@$(SCRIPTS)getsummary $(LIST)

percent:
	@$(SCRIPTS)getpercent $(LIST)

roff:
	echo .nf	> summary.roff
	echo .ft CB	>> summary.roff
	echo .ps 12	>> summary.roff
	echo .po .35i	>> summary.roff
	echo .sp .5i	>> summary.roff
	make summary	>> summary.roff
	echo .bp	>> summary.roff
	echo .sp .5i	>> summary.roff
	make percent	>> summary.roff

list:
	@echo $(LIST)

print: bargraphs ctx mem

8:
	make LIST="$(LIST)" PRINT="groff -p | mpage -P -8 -a | lpr -h" print

8.ps 8ps 8up:
	make LIST="$(LIST)" PRINT="$(PS8UP)" print

ps:
	make LIST="$(LIST)" PRINT="groff -p | $(SCRIPTS)save PS/PS" print

x: 
	make LIST="$(LIST)" PRINT="$(SCRIPTS)xroff -p" print

mem:
	-@mkdir tmp PS 2>/dev/null
	$(SCRIPTS)getmem $(LIST)
	for i in $(LIST); \
	do	f=`basename $$i`; \
		$(SCRIPTS)graph -close -big -nomarks -logx -xm tmp/mem.$$f; \
		echo .bp; \
        done | $(PRINT)

ctx:
	-@mkdir PS tmp 2>/dev/null
	$(SCRIPTS)getctx $(LIST)
	for i in $(LIST); \
	do	f=`basename $$i`; \
		$(SCRIPTS)graph -big -below tmp/ctx.$$f; \
		echo .bp; \
	done | $(PRINT)

bargraphs.1st:
	-@mkdir PS tmp 2>/dev/null
	$(SCRIPTS)getbg $(LIST)
	$(SCRIPTS)getmax $(LATENCY)
	$(SCRIPTS)getmax $(BANDWIDTH)

bargraphs: bargraphs.1st
	for i in $(BG); \
	do	$(SCRIPTS)bargraph -big -nobox $$i; \
		echo .bp; \
        done | $(PRINT)

bargraphs.8up: bargraphs.1st
	for i in $(BG); \
	do	$(SCRIPTS)bargraph -big -nobox $$i; \
		echo .bp; \
	done | $(PS8UP)

latency.8up: bargraphs.1st
	for i in $(LATENCY); \
	do	$(SCRIPTS)bargraph -big -nobox $$i; \
		echo .bp; \
	done | $(PS8UP)

bw.8up: bargraphs.1st
	for i in $(BANDWIDTH); \
	do	$(SCRIPTS)bargraph -big -nobox $$i; \
		echo .bp; \
	done | $(PS8UP)

clean:
	/bin/rm -f PS/* tmp/* summary.roff
