summaryRprof              package:utils              R Documentation

_S_u_m_m_a_r_i_s_e _O_u_t_p_u_t _o_f _R _S_a_m_p_l_i_n_g _P_r_o_f_i_l_e_r

_D_e_s_c_r_i_p_t_i_o_n:

     Summarise the output of the 'Rprof' function to show the amount of
     time used by different R functions.

_U_s_a_g_e:

     summaryRprof(filename = "Rprof.out", chunksize = 5000,
                   memory=c("none","both","tseries","stats"),
                   index=2, diff=TRUE, exclude=NULL)

_A_r_g_u_m_e_n_t_s:

filename: Name of a file produced by 'Rprof()'

chunksize: Number of lines to read at a time

  memory: Summaries for memory information.  See 'Details' below

   index: How to summarize the stack trace for memory information.  See
          'Details' below.

    diff: If 'TRUE' memory summaries use change in memory rather than
          current memory

 exclude: Functions to exclude when summarizing the stack trace for
          memory summaries

_D_e_t_a_i_l_s:

     This function is an alternative to '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 'chunksize' lines. Increasing
     'chunksize' will make the function run faster if sufficient memory
     is available.

     When called with 'memory.profiling=TRUE', the profiler writes
     information on three aspects of memory use: vector memory in small
     blocks on the R heap, vector memory in large blocks (from
     'malloc'), memory in nodes on the R heap.  It also records the
     number of calls to the internal function 'duplicate' in the time
     interval. 'duplicate' is called by C code when arguments need to
     be copied. Note that the profiler does not track which function
     actually allocated the memory.

     With 'memory="both"' the change in total memory (truncated at
     zero) is reported in addition to timing data. 

     With 'memory="tseries"' or 'memory="stats"' the 'index' argument
     specifies how to summarize the stack trace. A positive number
     specifies that many calls from the bottom of the stack; a negative
     number specifies the number of calls from the top of the stack. 
     With 'memory="tseries"' the index is used to construct labels and
     may be a vector to give multiple sets of labels. With
     'memory="stats"' the index must be a single number and specifies
     how to aggregate the data to the maximum and average of the memory
     statistics.  With both 'memory="tseries"' and 'memory="stats"' the
     argument 'diff=TRUE' asks for summaries of the increase in memory
     use over the sampling interval and 'diff=FALSE' asks for the
     memory use at the end of the interval.

_V_a_l_u_e:

     If 'memory="none"',a  list with components 

 by.self: Timings sorted by 'self' time

by.total: Timings sorted by 'total' time

sampling.time: Total length of profiling run


     If 'memory="both"' the same list but with memory consumption in Mb
     in addition to the timings.  

     If 'memory="tseries"' a data frame giving memory statistics over
     time

     If 'memory="stats"' a 'by' object giving memory statistics by
     function.

_S_e_e _A_l_s_o:

     The chapter on "Tidying and profiling R code" in "Writing R
     Extensions" (see the 'doc/manual' subdirectory of the R source
     tree).

     'Rprof'

     'tracemem' traces copying of an object via the C function
     'duplicate'.

     'Rprofmem' is a non-sampling memory use profiler.

     <URL: http://developer.r-project.org/memory-profiling.html>

_E_x_a_m_p_l_e_s:

     ## Not run: 
     ## Rprof() is not available on all platforms
     Rprof(tmp <- tempfile())
     example(glm)
     Rprof()
     summaryRprof(tmp)
     unlink(tmp)
     ## End(Not run)

