\HeaderA{proc.time}{Running Time of R}{proc.time}
\aliasA{print.proc\_time}{proc.time}{print.proc.Rul.time}
\keyword{utilities}{proc.time}
\begin{Description}\relax
\code{proc.time} determines how much real and CPU time (in seconds)
the currently running \R{} process has already taken.
\end{Description}
\begin{Usage}
\begin{verbatim}
proc.time()
\end{verbatim}
\end{Usage}
\begin{Details}\relax
\code{proc.time} returns five elements for backwards compatibility,
but its \code{print} method prints a named vector of
length 3.  The first two entries are the total user and system CPU
times of the current \R{} process and any child processes on which it
has waited, and the third entry is the \sQuote{real} elapsed time
since the process was started.
\end{Details}
\begin{Value}
An object of class \code{"proc\_time"} which is a numeric vector of
length 5, containing the user, system, and total elapsed times for the
currently running \R{} process, and the cumulative sum of user and
system times of any child processes spawned by it on which it has
waited.  (The \code{print} method combines the child times with those
of the main process.)

The definition of \sQuote{user} and \sQuote{system} times is from your
OS.  Typically it is something like

\emph{The \sQuote{user time} is the CPU time charged for the execution
of user instructions of the calling process. The \sQuote{system time}
is the CPU time charged for execution by the system on behalf of the
calling process.}

The resolution of the times will be system-specific
and on Unix-alikes times are rounded to the nearest 1ms.  On modern
systems they will be that accurate, but on older systems they might be
accurate to 1/100 or 1/60 sec.

This is a \LinkA{primitive}{primitive} function.
\end{Value}
\begin{Note}\relax
It is possible to compile \R{} without support for \code{proc.time},
when the function will throw an error.
\end{Note}
\begin{References}\relax
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
\emph{The New S Language}.
Wadsworth \& Brooks/Cole.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{system.time}{system.time}} for timing a valid \R{} expression,
\code{\LinkA{gc.time}{gc.time}} for how much of the time was spent in garbage
collection.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}## Not run: 
## a way to time an R expression: system.time is preferred
ptm <- proc.time()
for (i in 1:50) mad(stats::runif(500))
proc.time() - ptm
## End(Not run)\end{ExampleCode}
\end{Examples}

