\Header{summaryRprof}{Summarise Output of R Profiler}
\keyword{utilities}{summaryRprof}
\begin{Description}\relax
Summarise the output of the \code{\Link{Rprof}} function to show the
amount of time used by different \R{} functions.\end{Description}
\begin{Usage}
\begin{verbatim}
summaryRprof(filename = "Rprof.out", chunksize = 5000)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{filename}] Name of a file produced by \code{Rprof()}
\item[\code{chunksize}] Number of lines to read at a time
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function is an alternative to \code{R CMD Rprof}. It provides the
convenience of an all-\R{} implementation but will be slower for large
files.

As the profiling output file could be larger than available memory, it
is read in blocks of \code{chunksize} lines. Increasing \code{chunksize}
will make the function run faster if sufficient memory is available.\end{Details}
\begin{Value}
A list with components
\begin{ldescription}
\item[\code{by.self}] Timings sorted by \sQuote{self} time
\item[\code{by.total}] Timings sorted by \sQuote{total} time
\item[\code{sampling.time}] Total length of profiling run
\end{ldescription}
\end{Value}
\begin{SeeAlso}\relax
The chapter on \dQuote{Tidying and profiling R code} in
\dQuote{Writing \R{} Extensions} (see the \file{doc/manual} subdirectory
of the \R{} source tree).

\code{\Link{Rprof}}\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## Don't run: 
## Rprof() is not available on all platforms
Rprof(tmp <- tempfile())
example(glm)
Rprof()
summaryRprof(tmp)
unlink(tmp)
## End Don't run
\end{ExampleCode}
\end{Examples}

