Raw File
tictoc.Rd
\name{tic,toc}
\alias{tic}
\alias{toc}
\title{MATLAB timer functions}
\description{
  Provides stopwatch timer. Function \code{tic} starts the timer and \code{toc}
  updates the elapsed time since the timer was started. 
}
\usage{
tic(gcFirst=FALSE)
toc(echo=TRUE)
}
\arguments{
  \item{gcFirst}{logical scalar. If \code{TRUE}, perform garbage collection
    prior to starting stopwatch}
  \item{echo}{logical scalar. If \code{TRUE}, print elapsed time to screen}
}
\details{
  Provides analog to \code{\link[base]{system.time}}.
  Function \code{toc} can be invoked multiple times in a row.
}
\value{
  \code{toc} invisibly returns the elapsed time as a named scalar (vector).
}
\examples{
tic()
for(i in 1:100) mad(runif(1000))	# kill time
toc()
}
\author{
  P. Roebuck \email{proebuck@mdanderson.org}
}
\keyword{utilities}

back to top