profileCallGraph2Dot {proftools} | R Documentation |
Prints a Graphviz .cot file representation of the call graph for profile
data produced by Rprof
.
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)
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. |
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))
Used for side effect.
Because of lazy evaluation, nested calls like f(g(x))
appear in the profile graph as f
or one of its callees
calling g
.
Luke Tierney
User manual for gprof
, the GNU profiler.
Graphviz: http://www.research.att.com/sw/tools/graphviz/
Rprof
,
summaryRprof
,
readProfileData
,
flatProfile
,
plotProfileCallGraph
,
printProfileCallGraph
## 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)