\Header{system.time}{CPU Time Used}
\alias{unix.time}{system.time}
\keyword{utilities}{system.time}
\begin{Usage}
\begin{verbatim}
system.time(expr)
unix.time(expr)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{expr}] Valid \R\ expression to be ``timed''
\end{ldescription}
\end{Arguments}
\begin{Description}
Return CPU (and other) times that \texttt{expr} used.\end{Description}
\begin{Details}
\texttt{system.time} calls the builtin \texttt{\Link{proc.time}},
evaluates \texttt{expr}, and then calls \texttt{proc.time} once more,
returning the difference between the two \texttt{proc.time} calls.

The values returned by the \texttt{proc.time} are (currently) those
returned by the C library function \texttt{times}(3v).

\texttt{unix.time} is an \texttt{\Link{.Alias}} of \texttt{system.time}, for
compatibility reasons.\end{Details}
\begin{Value}
A numeric vector of length 5 containing the cpu, user, total,
subproc1, subproc2 times.\end{Value}
\begin{SeeAlso}
\texttt{\Link{proc.time}}, \texttt{\Link{time}} which is for time series.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
system.time(for(i in 1:50) mad(runif(500)))
exT <- function(n = 100) {
  # Purpose: Test if system.time works ok;   n: loop size
  system.time(for(i in 1:n) x <- mean(rt(1000, df=4)))
}
#-- Try to interrupt one of the following (using Ctrl-C):
exT()                 #- `1.4' on -O-optimized Ultra1
system.time(exT())    #~ +/- same
\end{ExampleCode}
\end{Examples}

