proftools (version 0.99-3)

printProfileCallGraph: Print Call Graph for Rprof Profile Data

Description

Prints a representation of the call graph for profile data produced by Rprof. Output can be directed to a connection or a file.

Usage

printProfileCallGraph(pd, file = stdout(), percent = TRUE, GC = TRUE,
                      maxnodes = NA, total.pct = 0)

Arguments

pd

profile data as returned by readProfileData.

file

a connection or the name of the file where the profile graph will be written.

percent

logical; if true use percent of total time; otherwise use time in seconds

GC

logical; include GC information or not.

maxnodes

integer; maximal number of nodes to use; nodes with lower total hit counts are dropped.

total.pct

numeric; if positive, nodes with hit percentages below this level are dropped.

Value

Used for side effect.

Details

printProfileCallGraph produces a printed representation of the call graph for profile data produced by Rprof. The representation is analogous to the call graph produced by gprof with a few minor changes. Eventually more complete documentation of the format will be provided here; for now, reading the gprof manual section on the call graph should help understanding this output. The output is similar enough to gprof output for the cgprof script to be able to produce a visual representation of the call graph via Graphviz.

References

User manual for gprof, the GNU profiler.

cgprof: http://mvertes.free.fr/

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

See Also

Rprof, summaryRprof, flatProfile, readProfileData, plotProfileCallGraph, profileCallGraph2Dot

Examples

Run this code
# NOT RUN {
pd <- readProfileData(system.file("samples", "glmEx.out", package="proftools"))
printProfileCallGraph(pd)
# }
# NOT RUN {
## If you have graphviz and cgprof installed on a UNIX-like system
## then in R do:

pd <- readProfileData(system.file("samples", "glmEx.out", package="proftools"))
printProfileCallGraph(pd, "foo.graph")

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

cgprof -TX foo.graph

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

cgprof -Tps foo.graph > foo.ps
gv foo.ps
  
# }

Run the code above in your browser using DataCamp Workspace