Rprof                  package:base                  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 = TRUE, interval = 0.02)

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

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

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

_E_x_a_m_p_l_e_s:

     Rprof()
     ## some code to be profiled
     Rprof(NULL)
     ## some code NOT to be profiled
     Rprof(append=TRUE)
     ## some code to be profiled
     Rprof(NULL)
     ...
     ## Post-process the output by
     ##   R CMD Rprof Rprof.out
     ## at the shell prompt.

