-#!/bin/sh -x
+#!/bin/sh
#
# Produces a .tar file (if one doesn't exist as $TARFILE), then
# times how long it takes to untar it onto the current directory.
{
# %U=user %S=system %E=elapsed
mkdir ./tar || exit 1
- cd tar
- /usr/bin/time -f '%U,%S,%E' tar xf $TARFILE || exit 1
+ size=`ls -lh $TARFILE | awk '{print $5}'`
+ time=`/usr/bin/time -f '%U,%S,%E' tar xf $TARFILE 2>&1`
+ status=$?
cd ..
- rm -fr ./tar || exit 1
+ rm -fr ./tar
+ [ $status -eq 0 ] || exit 1
+ echo "$size,$time"
}
if [ $# -gt 0 ]; then
- echo "user,system,elapsed"
+ echo "sz,usr,sys,real"
exit 0
fi
new_tar