Last active
August 29, 2015 14:19
-
-
Save neale/745f2756fb181ab53852 to your computer and use it in GitHub Desktop.
Times programs in your directory and logs times to a file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
trap 'exit' ERR | |
set -u | |
DIR="$(pwd)" | |
LOG="$DIR/times/times.txt" | |
PROGRAMS=($(find $DIR -maxdepth 1 -type f | grep -v "$(basename $0)")) | |
mkdir -p $DIR/times | |
touch $LOG | |
echo "timing for each random array" | |
for i in "${PROGRAMS[@]}"; do | |
if [[ -x "$i" ]]; then | |
echo "generating program time for $i" | |
{ time $i > /dev/null 2>&1 ; } 2>> $LOG | |
else | |
echo "$i is not timed, and exec permissions to time" | |
fi | |
done | |
echo "finshed, times for each program can be found in $LOG" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment