#!/bin/sh

if [ $# = 0 ]; then
  exit 1
fi

case "$1" in
  *gz) CAT="gunzip -c" ;;
  *Z)  CAT="uncompress -c" ;;
  *)   CAT="cat" ;;
esac


$CAT "$@" | egrep 'Time = |CPU time =' \
       | tr -d '(),' #\
       | awk '{ if ($1 == "Time") t = $3; \
		if ($1 == "CPU" && $5 == "delta") print t, $7;}' \
       | plot_data -q -x 'time' -y 'd(CPU)' -C red -h "Data from $*"
