count running time in R template