Created
July 22, 2015 00:23
-
-
Save rozap/5f23fbb9b12e4c6cf9b9 to your computer and use it in GitHub Desktop.
tracking how long i spend waiting for sbt
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
#!/bin/bash | |
timestamp() { | |
date +%s%3N | |
} | |
watch_dir=$1 | |
echo "Watching $watch_dir ..." | |
cmd="" | |
while test ${#} -gt 0 | |
do | |
cmd="$cmd $2" | |
shift | |
done | |
while inotifywait -r -e modify $watch_dir; do | |
echo "Embarking upon a task $cmd" | |
start_time=$(timestamp) | |
${cmd} | |
end_time=$(timestamp) | |
delta=$((end_time - start_time)) | |
echo "Running $cmd took $delta seconds" | |
echo "${cmd}, $start_time, $delta" >> "times.csv" | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment