Skip to content

Instantly share code, notes, and snippets.

@rozap
Created July 22, 2015 00:23
Show Gist options
  • Save rozap/5f23fbb9b12e4c6cf9b9 to your computer and use it in GitHub Desktop.
Save rozap/5f23fbb9b12e4c6cf9b9 to your computer and use it in GitHub Desktop.
tracking how long i spend waiting for sbt
#!/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