umx_time: umx_time

umx_timeR Documentation

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.

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.

Value

  • invisible time string

References

See Also

Other Reporting Functions: umxAPA(), umxFactorScores(), umxGetLatents(), umxGetManifests(), umxGetModel(), umxGetParameters(), umxParameters(), umx_aggregate(), umx

Examples

## Not run: 
require(umx)
umx_time('stop') # alert user stop called when not yet started... 
umx_time('stop')
umx_time('start')
data(demoOneFactor)
latents  = c("G")
manifests = names(demoOneFactor)
myData = mxData(cov(demoOneFactor), type = "cov", numObs=500)
m1 = umxRAM("umx_time_example", data = myData,
	umxPath(from = latents, to = manifests),
	umxPath(var = manifests),
	umxPath(var = latents, fixedAt = 1)
)
umx_time(m1) # report time from mxModel
m2 = umxRun(m1)
umx_time(c(m1, m2)) # print comparison table
umx_time('stop') # report the time since timer last started, and restart
umx_time('stop') # report the time since timer was restarted.

## End(Not run)


umx documentation built on May 29, 2024, 5:40 a.m.