#!/bin/csh -f
#
# qex - quickly extract a parameter or metric from a set of sim files
#   default for array metrics is -sum

set usage='usage: qex parameter-name foo.sim[.gz]...'
#
# 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

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

set tmp=/tmp/qex$$
onintr cleanup

set stat=$1
foreach file ($argv[2-])
    set val=`simex -sim $file -noname -noheader -sum $stat`
    echo $val $file
end

cleanup:
rm -f $tmp
