add time func to estimate the elapsed time.