umx (version 1.9.1)

umx_time: umx_time

Description

A function to compactly report how long a model took to execute. Comes with some preset styles User can set the format with C-style string formatting.

Usage

umx_time(x = NA, formatStr = c("simple", "std", "custom %H %M %OS3"),
  tz = "GMT", autoRun = TRUE)

Arguments

x

A mxModel or list of models for which to display elapsed time, or 'start' or 'stop'

formatStr

A format string, defining how to show the time (defaults to human readable)

tz

time zone in which the model was executed (defaults to "GMT")

autoRun

If TRUE (default), run the model if it appears not to have been.

Value

- invisible time string

Details

The default time format is "simple", which gives only the biggest unit used. i.e., "x seconds" for times under 1 minute. "std" shows time in the format adopted in OpenMx 2.0 e.g. "Wall clock time (HH:MM:SS.hh): 00:00:01.16"

If a list of models is provided, time deltas will also be reported.

If instead of a model the key word "start" is given in x, a start time will be recorded. "stop" gives the time since "start" was called (and clears the timer)

If a model has not been run, umx_time will run it for you.

References

- http://www.github.com/tbates/umx

See Also

Other Reporting Functions: loadings.MxModel, tmx_is.identified, umxAPA, umxFactorScores, umxGetParameters, umxReduce, umxSummary, umx_APA_pval, umx_aggregate, umx_parameters, umx_print, umx_show, umx

Examples

Run this code
# NOT RUN {
require(umx)
umx_time('start')
data(demoOneFactor)
latents  = c("G")
manifests = names(demoOneFactor)
myData = mxData(cov(demoOneFactor), type = "cov", numObs = 500)
m1 <- umxRAM("One Factor", data = myData,
	umxPath(from = latents, to = manifests),
	umxPath(var = manifests),
	umxPath(var = latents, fixedAt = 1)
)
umx_time(m1)
m2 = umxRun(m1)
umx_time(c(m1, m2))
umx_time('stop')
# elapsed time: .3 seconds
# }

Run the code above in your browser using DataCamp Workspace