Then add the following code to your ~/.bashrc:
. ~/.preexec.bash
# called before each command and starts stopwatch
function preexec () {
export PREEXEC_CMD="$BASH_COMMAND"
export PREEXEC_TIME=$(date +'%s')
}
# called after each command, stops stopwatch
# and notifies if time elpsed exceeds threshold
function precmd () {
stop=$(date +'%s')
start=${PREEXEC_TIME:-$stop}
let elapsed=$stop-$start
max=${PREEXEC_MAX:-10}
if [ $elapsed -gt $max ]; then
growlnotify -n "iTerm" -m "took $elapsed secs" ${PREEXEC_CMD:-Some Command}
fi
}
preexec_installNow whenever a shell command takes longer than 10 seconds to finish, Growl will notify you about it. To change the threshold temporarily, use export PREEXEC_MAX=20. To change it permanently, just change it in the code you just appended to ~/.bashrc.
[robg adds: I haven't tested this one.]

