Report the run time in seconds. For MCMC additional information is provided about the run times of individual chains and the warmup and sampling phases.

time()

Value

A list with elements

  • total: (scalar) the total run time.

  • chains: (data frame) for MCMC only, timing info for the individual chains. The data frame has columns "chain_id", "warmup", "sampling", and "total".

See also

Examples

# \dontrun{ fit_mcmc <- cmdstanr_example("logistic", method = "sample")
#> Model executable is up to date!
fit_mcmc$time()
#> $total #> [1] 0.9395189 #> #> $chains #> chain_id warmup sampling total #> 1 1 0.028 0.124 0.152 #> 2 2 0.035 0.109 0.144 #> 3 3 0.028 0.101 0.129 #> 4 4 0.042 0.149 0.191 #>
fit_mle <- cmdstanr_example("logistic", method = "optimize")
#> Model executable is up to date!
fit_mle$time()
#> $total #> [1] 0.1158781 #>
fit_vb <- cmdstanr_example("logistic", method = "variational")
#> Model executable is up to date!
fit_vb$time()
#> $total #> [1] 0.1155372 #>
# }