#!/bin/csh -f
#
# doscatter-all - do a scatter plot of general-vs-cache for the given 
#   set of patterns and configs
# I generally use doscatter-big, not this program.
#
set usage='usage: doscatter-all [-t title] patfile Nio Ncomp config...'
#
# Part of
#              The STARFISH Parallel file-system simulator
#        (Simulation Tool for Advanced Research in File Systems)
# 
#                               David Kotz
#                           Dartmouth College
#                              Version 3.0
#                              October 1996
#                          dfk@cs.dartmouth.edu

# extract optional title
unset title
if ($#argv > 0 && "$1" == -t) then
    if ($#argv > 1) then
    	   set title="$2"
           shift; shift
    else
	echo "$usage"
	exit 1
    endif
else
    if ($#argv == 0) then
	echo "$usage"
	exit 1
    endif
endif

if ($#argv <= 3) then
    echo "$usage"
    exit 1
endif

set patfile=$1
set Nio=$2
set Ncomp=$3
set dirs=($argv[4-])

if (! -f "$patfile") then
    echo Can not access pattern file "$patfile"
    exit 1
endif

foreach pat (`cat $patfile`)
    set files=()
    foreach dir ($dirs)
	set files=($files $dir/results/$pat.$Nio.$Ncomp.avg)
    end
    if ($?title) then
	doscatter-one -t "$title, pattern $pat" $files
    else
	doscatter-one -t "Scatter general vs. cache, pattern $pat" $files
    endif
end
