Files
apfstests/run.tar
T

38 lines
593 B
Bash
Executable File

#!/bin/sh -x
#
# Produces a .tar file (if one doesn't exist as $TARFILE), then
# times how long it takes to untar it onto the current directory.
#
TARFILE=${TARFILE:=/var/tmp/bench.tar}
barf()
{
echo $@ >2
exit 1
}
new_tar()
{
source="bin sbin lib"
if [ ! -f $TARFILE ]; then
( cd / && tar cf $TARFILE $source ) || barf "tar c failed"
fi
}
run_tar()
{
# %U=user %S=system %E=elapsed
mkdir ./tar || exit 1
cd tar
/usr/bin/time -f '%U,%S,%E' tar xf $TARFILE || exit 1
cd ..
rm -fr ./tar || exit 1
}
if [ $# -gt 0 ]; then
echo "user,system,elapsed"
exit 0
fi
new_tar
run_tar