Tools for examining and displaying ouptut from the Rprof
R
profiling tool.
proftools provides a set of tools for summarizing and displaying
time profile outpus produced by R's Rprof
.
The starting point for a profiling analysis using proftools is
to profile code using Rprof
and then use
readProfileData
to read in the profile data into a
sutable format for furhter processing. An alternative is to use the
profileExpr
function to handle profiling and reading in
one step. The function filterProfileData
can be used to
narrow the profile data to particular regions of interest.
The summary functions funSummary
and
callSummary
produce summaries at the function and call
level. pathSummary
produces a summary for each unique
call stack, or path; and hotPaths
identifies produces
path data ordered to show the hottest paths first.
If source information is recorded when profiling then
srcSummary
to show profiling by source lines, and
annotateSource
produces an annotated version of the
source files.
The plot
method for profile data objects can produce
call graphs, tree maps, flame graphs, and time graphs; the
type
argument choses the particular visualization to
produce. These graphs can also be produced by the functions
plotProfileCallGraph
, calleeTreeMap
, and
flameGraph
.
The function writeCallgrindFile
writes a file for use
by the codekcachegrind program available on some operating
systems.
flatProfile
1 2 3 4 5 6 7 | pd <- readProfileData(system.file("samples", "glmEx.out", package="proftools"))
funSummary(pd)
callSummary(pd)
pathSummary(pd)
hotPaths(pd)
plot(pd)
plot(filterProfileData(pd, focus = "glm", self.pct=1, total.pct=10))
|
total.pct self.pct
system.time 100 0
sapply 100 0
replicate 100 0
lapply 100 0
FUN 100 4
summary 80 0
glm 76 0
eval 68 0
glm.fit 36 8
paste 28 0
match 28 0
deparse 28 16
%in% 28 4
model.frame.default 24 0
mode 24 4
<Anonymous> 24 0
ifelse 16 12
dev.resids 16 0
data.frame 16 0
force 12 0
as.data.frame.numeric 12 0
as.data.frame 12 0
model.matrix.default 8 0
model.matrix 8 0
getExportedValue 8 0
:: 8 0
.deparseOpts 8 4
.External2 8 4
$ 8 8
unique.default 4 4
unique 4 0
summary.glm 4 0
simplify2array 4 0
names 4 4
na.omit.data.frame 4 0
na.omit 4 0
mu.eta 4 4
length 4 4
is.na 4 4
is.atomic 4 4
getNamespace 4 0
getInternalExportName 4 0
exists 4 4
asNamespace 4 0
as.name 4 4
[[.data.frame 4 0
[[ 4 0
[ 4 4
total.pct self.pct
system.time -> replicate 100 0
sapply -> lapply 100 0
replicate -> sapply 100 0
lapply -> FUN 100 4
FUN -> summary 80 0
summary -> glm 76 0
glm -> eval 68 0
eval -> eval 68 0
eval -> glm.fit 36 8
paste -> deparse 28 4
match -> mode 24 4
eval -> <Anonymous> 24 0
deparse -> %in% 24 0
<Anonymous> -> model.frame.default 24 0
%in% -> match 24 0
model.frame.default -> sapply 20 0
mode -> deparse 20 12
glm.fit -> dev.resids 16 0
dev.resids -> ifelse 16 12
FUN -> paste 16 0
FUN -> data.frame 16 0
force -> paste 12 0
data.frame -> as.data.frame 12 0
as.data.frame.numeric -> force 12 0
as.data.frame -> as.data.frame.numeric 12 0
model.matrix -> model.matrix.default 8 0
glm.fit -> $ 8 8
glm -> model.matrix 8 0
eval -> :: 8 0
deparse -> .deparseOpts 8 4
:: -> getExportedValue 8 0
unique -> unique.default 4 4
summary.glm -> [ 4 4
summary -> summary.glm 4 0
simplify2array -> unique 4 0
sapply -> simplify2array 4 0
names -> names 4 4
na.omit.data.frame -> [[ 4 0
na.omit -> na.omit.data.frame 4 0
model.matrix.default -> match 4 0
model.matrix.default -> .External2 4 4
model.frame.default -> .External2 4 0
match -> names 4 0
length -> length 4 4
ifelse -> is.atomic 4 4
glm.fit -> mu.eta 4 4
getNamespace -> as.name 4 4
getInternalExportName -> exists 4 4
getExportedValue -> getInternalExportName 4 0
getExportedValue -> asNamespace 4 0
data.frame -> length 4 0
asNamespace -> getNamespace 4 0
[[.data.frame -> %in% 4 4
[[ -> [[.data.frame 4 0
.deparseOpts -> is.na 4 4
.External2 -> na.omit 4 0
total.pct
... eval -> glm.fit -> dev.resids -> ifelse 12
... deparse -> %in% -> match -> mode -> deparse 12
... summary -> glm -> eval -> eval -> glm.fit 8
... glm -> eval -> eval -> glm.fit -> $ 8
... simplify2array -> unique -> unique.default 4
... sapply -> lapply -> FUN -> paste -> deparse 4
... replicate -> sapply -> lapply -> FUN 4
... paste -> deparse -> %in% -> match -> mode 4
... model.matrix.default -> .External2 4
... mode -> deparse -> .deparseOpts -> is.na 4
... match -> names -> names 4
... match -> mode -> deparse -> .deparseOpts 4
... lapply -> FUN -> summary -> summary.glm -> [ 4
... glm.fit -> dev.resids -> ifelse -> is.atomic 4
... glm -> eval -> eval -> glm.fit -> mu.eta 4
... getInternalExportName -> exists 4
... asNamespace -> getNamespace -> as.name 4
... [[ -> [[.data.frame -> %in% 4
... FUN -> data.frame -> length -> length 4
path total.pct self.pct
system.time 100 0
. replicate 100 0
. . sapply 100 0
. . . lapply 100 0
. . . . FUN 100 4
. . . . . summary 80 0
. . . . . . glm 76 0
. . . . . . . eval 68 0
. . . . . . . . eval 68 0
. . . . . . . . . glm.fit 36 36
. . . . . . . . . <Anonymous> 24 24
. . . . . . . . . :: 8 8
. . . . . . . model.matrix 8 0
. . . . . . . . model.matrix.default 8 0
. . . . . . . . . .External2 4 4
. . . . . . . . . match 4 4
. . . . . . summary.glm 4 0
. . . . . . . [ 4 4
. . . . . data.frame 16 0
. . . . . . as.data.frame 12 0
. . . . . . . as.data.frame.numeric 12 0
. . . . . . . . force 12 0
. . . . . . . . . paste 12 12
. . . . . . length 4 0
. . . . . . . length 4 4
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.