Optimized show_progress() to reduce the calls to gettimeofday() when