Skip to content

Instantly share code, notes, and snippets.

@sinamiandashti
Created March 11, 2019 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sinamiandashti/a8c9a5bf7e89a0c3a0f00e0bc5d06308 to your computer and use it in GitHub Desktop.
Save sinamiandashti/a8c9a5bf7e89a0c3a0f00e0bc5d06308 to your computer and use it in GitHub Desktop.
function start_progress {
while true
do
echo -ne "#"
sleep 1
done
}
function stop_progress {
kill $1
wait $1 2>/dev/null
echo -en "\n"
}
tar_file=tarfile
echo -n " PROCESSING CPU PERFORMANCE "
dd if=/dev/urandom of=$tar_file bs=1024 count=25000 >>/dev/null 2>&1
start_progress &
pid="$!"
tf=$( (/usr/bin/time -f "%es" tar cfj $tar_file.bz2 $tar_file) 2>&1 )
stop_progress "$pid"
rm -f tarfile*
echo $tf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment