Rev 87961 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/base/man/proc.time.Rd% Part of the R package, https://www.R-project.org% Copyright 1995-2025 R Core Team% Distributed under GPL 2 or later\name{proc.time}\alias{proc.time}\alias{print.proc_time}\alias{summary.proc_time}\title{Running Time of R}\description{\code{proc.time} determines how much real and CPU time (in seconds)the currently running \R process has already taken.}\usage{proc.time()}\details{\code{proc.time} returns five elements for backwards compatibility,but its \code{print} method prints a named vector oflength 3. The first two entries are the total user and system CPUtimes of the current \R process and any child processes on which ithas waited, and the third entry is the \sQuote{real} elapsed timesince the process was started.}\value{An object of class \code{"proc_time"} which is a numeric vector oflength 5, containing the user, system, and total elapsed times for thecurrently running \R process, and the cumulative sum of user andsystem times of any child processes spawned by it on which it haswaited. (The \code{print} method uses the \code{summary} method tocombine the child times with those of the main process.)The definition of \sQuote{user} and \sQuote{system} times is from yourOS. Typically it is something like\emph{The \sQuote{user time} is the CPU time charged for the executionof user instructions of the calling process. The \sQuote{system time}is the CPU time charged for execution by the system on behalf of thecalling process.}Times of child processes are not available on Windows and will alwaysbe given as \code{NA}.The resolution of the times will be system-specific and on Unix-alikestimes are rounded down to milliseconds. On modern systems they willbe that accurate, but in the 20th century they might havebeen accurate to 1/100 or 1/60 sec. They are typically available to10ms on Windows.This is a \link{primitive} function.}\references{Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)\emph{The New S Language}.Wadsworth & Brooks/Cole.}\seealso{\code{\link{system.time}} for timing an \R expression,\code{\link{gc.time}} for how much of the time was spent in garbagecollection.\code{\link{setTimeLimit}} to \emph{limit} the CPU or elapsed time forthe session or an expression.}\examples{\donttest{## a way to time an R expression: system.time is preferredptm <- proc.time()for (i in 1:50) mad(stats::runif(500))proc.time() - ptm}}\keyword{utilities}