Rprof                 package:utils                 R Documentation

_E_n_a_b_l_e _P_r_o_f_i_l_i_n_g _o_f _R'_s _E_x_e_c_u_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Enable or disable profiling of the execution of R expressions.

_U_s_a_g_e:

     Rprof(filename = "Rprof.out", append = FALSE, interval = 0.02,
            memory.profiling=FALSE)

_A_r_g_u_m_e_n_t_s:

filename: The file to be used for recording the profiling results. Set
          to 'NULL' or '""' to disable profiling. 

  append: logical: should the file be over-written or appended to? 

interval: real: time interval between samples. 

memory.profiling: logical: write memory use information to the file?

_D_e_t_a_i_l_s:

     Enabling profiling automatically disables any existing profiling
     to another or the same file.

     Profiling works by writing out the call stack every 'interval'
     seconds, to the file specified.  Either the 'summaryRprof'
     function or the Perl script 'R CMD Rprof' can be used to process
     the output file to produce a summary of the usage; use 'R CMD
     Rprof --help' for usage information.

     Note that the timing interval cannot be too small: once the timer
     goes off, the information is not recorded until the next timing
     click (probably in the range 1-10msecs).

_N_o_t_e:

     Profiling is not available on all platforms.  By default, it is
     attempted to compile support for profiling.  Configure R with
     '--disable-R-profiling' to change this.

     As R profiling uses the same mechanisms as C profiling, the two
     cannot be used together, so do not use 'Rprof' in an executable
     built for profiling.

_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).

     'summaryRprof'

     'tracemem', 'Rprofmem' for other ways to track memory use.

_E_x_a_m_p_l_e_s:

     ## Not run: 
     Rprof()
     ## some code to be profiled
     Rprof(NULL)
     ## some code NOT to be profiled
     Rprof(append=TRUE)
     ## some code to be profiled
     Rprof(NULL)
     ...
     ## Now post-process the output as described in Details
     ## End(Not run)

