#!/bin/csh -f
#
# doscatter-one - do a scatter plot of general-vs-cache for the given 
#   set of data files.  Data file names should be the cache names; 
#   general names are inferred. .avg or .data files can be used
#
set usage='usage: doscatter-one [-t title] configs/*cache*/results/foo.avg...'
#
# 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

set cachefiles=($*)

# extract optional title
if ($#argv > 0 && "$1" == -t) then
    if ($#argv > 1) then
    	   set title="$2"
	   set cachefiles=($argv[3-])
    else
	echo "$usage"
	exit 1
    endif
else
    set title = "Scatter general vs. cache"
    if ($#argv == 0) then
	echo "$usage"
	exit 1
    endif
endif

onintr cleanup
set tmp1=/tmp/doscatter-one$$a
set tmp2=/tmp/doscatter-one$$b

set generalfiles=(`echo $cachefiles | sed 's/cache/general/g'`)

# scale wrlw case down by Ncomp
cat $cachefiles | dm 'if x1=10 then x13/x10 else x13' > $tmp1
cat $generalfiles | dm 'if x1=10 then x13/x10 else x13' > $tmp2

scatter -t "$title" $tmp2 $tmp1

cleanup:
rm -f $tmp1 $tmp2
