add logging for calculate the cost of time