If you want to manually add some logging statements at key points in your script, you could include the following function in your bash script.
Note that it takes some time (~ 50 ms) to shell out to python to get the current timestamp, so using this will increase run times slightly, but will help you easily log time between commands in your script.
function traceTick(){
local CURR_TIME=$(python -c "import time; print(int(time.time()*1000))")
if [ -z "$LAST_TIME" ]
then
START_TIME=$CURR_TIME
LAST_TIME=$CURR_TIME
fi
local DELTA=$(($CURR_TIME - $LAST_TIME))
local TOTAL_DELTA=$(($CURR_TIME - $START_TIME))
LAST_TIME=$CURR_TIME
printf "elapsed(ms):%-6s delta(ms):%-6s %s\n" $TOTAL_DELTA $DELTA "$1"
}
Using it in a script like so
traceTick 'starting'
...
traceTick 'did something'
...
traceTick 'more stuff'
will output something like the following
elapsed(ms):0 delta(ms):0 starting
elapsed(ms):2597 delta(ms):2597 did something
elapsed(ms):6560 delta(ms):3963 more stuff