This function takes knitr's official example on using chunk hooks to report how much time each chunk takes to run: https://bookdown.org/yihui/rmarkdown-cookbook/time-chunk.html
time_chunk(all = TRUE)And just wrap it in a function so you can simply write efun::time_chunk()
in your top chunk, instead of the whole example.
if (FALSE) { # \dontrun{
# Simply put this line on the top chunk of your .Rmd file
efun::time_chunk(all = TRUE)
} # }