profileCallGraph2Dot        package:proftools        R Documentation

_W_r_i_t_e _C_a_l_l _G_r_a_p_h _f_o_r _R_p_r_o_f _P_r_o_f_i_l_e _D_a_t_a _t_o _G_r_a_p_h_v_i_z _D_o_t _F_i_l_e

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

     Prints a Graphviz .cot file representation of the call graph for
     profile data produced by 'Rprof'.

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

     profileCallGraph2Dot(pd, score = c("total", "self"),
                          transfer = function(x) x, colorMap = NULL,
                          filename = "Rprof.dot", landscape = FALSE,
                          mergeCycles = FALSE, edgesColored = TRUE,
                          rankdir = "LR", center = FALSE, size)

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

      pd: profile data as returned by 'readProfileData'.

   score: character string specifying whether to use total time or self
          time for coloring nodes/edges; no color used if missing. 

transfer: function; maps score values in unit interval to unit interval 

colorMap: character vector of color specifications as produced by
          'rainbow'; 'transfer' of score is mapped to color 

filename: name of '.dot' file 

landscape: logical; whether to ad the 'rotate=90' option to the '.dot'
          file 

mergeCycles: logical; whether to merge each cycle of recursion into a
          single node 

edgesColored: logical; whether to color edges 

 rankdir: character; value to use for the 'rankdir=' option to
          specifythe direction that the plot is laid out using the
          'dot' layout; must be either '"TB"' for Top-to-Bottom or
          '"LR"' for Left-to-Right.  The default value is '"LR"'.

  center: logical; whether to add the 'center=1' option to the '.dot'
          file. 

    size: character; string to add as 'size=' option in the '.dot'
          file. 

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

     Writes the call graph as a Graphviz '.dot' file. Color is used to
     encode the fraction total or self time spent in each function or
     call.  The scores used correspond to the values in the printed
     representation produced by 'printProfileCallGraph'.  For now, see
     the 'gprof' manual for further details.  The color encoding for a
     score 's' and a color map 'm' is 'ceiling(length(m) *
     transfer(s))'

_V_a_l_u_e:

     Used for side effect.

_N_o_t_e:

     Because of lazy evaluation, nested calls like 'f(g(x))' appear in
     the profile graph as 'f' or one of its callees calling 'g'.

_A_u_t_h_o_r(_s):

     Luke Tierney

_R_e_f_e_r_e_n_c_e_s:

     User manual for 'gprof', the GNU profiler.

     Graphviz: <URL: http://www.research.att.com/sw/tools/graphviz/>

_S_e_e _A_l_s_o:

     'Rprof', 'summaryRprof', 'readProfileData', 'flatProfile',
     'plotProfileCallGraph', 'printProfileCallGraph'

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

     ## Not run: 
          ## Rprof() is not available on all platforms
          Rprof(tmp <- tempfile())
          example(glm)
          Rprof()
          profileCallGraph2Dot(readProfileData(tmp), filename = tmp)
          file.show(tmp)
          unlink(tmp)

          ## If you have graphviz installed on a UNIX-like system
          ## then in R do:

          Rprof(tmp <- tempfile())
          example(glm)
          Rprof()
          profileCallGraph2Dot(readProfileData(tmp), score = "total",
                               filename = "foo.dot")

          ## and then in a shell do (to use the interactive dotty):

          dotty foo.dot

          ## or (to create a postscript version and view with gv)

          dot -Tps foo.dot > foo.ps
          gv foo.ps
       ## End(Not run)

