mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
4fa64f8a9d
make important argument mandatory, do a better job of collecting results.
41 lines
682 B
Bash
Executable File
41 lines
682 B
Bash
Executable File
#!/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.
|
|
#
|
|
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
|
|
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
|
|
[ $status -eq 0 ] || exit 1
|
|
echo "$size,$time"
|
|
}
|
|
|
|
if [ $# -gt 0 ]; then
|
|
echo "size,user,system,elapsed"
|
|
exit 0
|
|
fi
|
|
new_tar
|
|
run_tar
|