#!/bin/csh -f
#
# idleqq - plot the QQ of idles for a given prefetch elog (pair)
#
# usage: idleqq <log.elog> [<log2.elog>]
#
# Where logs are a NORMAL style elog, not a LOG2 type.
# If one elog is given, the second is assumed to be the
# non-prefetching version of the first. 
# The first file is on the y axis, the second on the x axis.

set P=`procdir`

if ($#argv < 1 || $#argv > 2) then
	   echo 'usage: idleqq log.elog [log2.elog]'
	   exit 1
endif

set logfile=$1:r
if ($#argv == 1) then
	   set base=`nonprefile $1`
	   set basefile=$base:r
else
	   set basefile=$2:r
endif

onintr cleanup

elogdump -st =2 =3 =16 $logfile  | Awk -f $P/idleqq.awk > /tmp/idleqq.y
elogdump -st =2 =3 =16 $basefile | Awk -f $P/idleqq.awk > /tmp/idleqq.n

qqplot -t "Idle time for $logfile and $basefile" /tmp/idleqq.y /tmp/idleqq.n

cleanup:
rm -f /tmp/idleqq.*
