printProfileCallGraph: Print Call Graph for Rprof Profile Data

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/proftools.R

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

1
2
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.

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.

Value

Used for side effect.

Note

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

Author(s)

Luke Tierney

References

User manual for gprof, the GNU profiler.

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

See Also

Rprof, summaryRprof, flatProfile, readProfileData, plotProfileCallGraph, profileCallGraph2Dot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
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
  
## End(Not run)

ltierney/Rpkg-proftools documentation built on July 12, 2020, 5:21 p.m.