Title: | An Alternative Display for Profiling Information |
---|---|
Description: | An alternative data structure and visual rendering for the profiling information generated by Rprof. |
Authors: | Hadley Wickham [aut, cre] |
Maintainer: | Hadley Wickham <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.3.3.9000 |
Built: | 2024-12-15 04:15:48 UTC |
Source: | https://github.com/hadley/profr |
profr
data.frame.This will plot the call tree of the specified stop watch object. If you only want a small part, you will need to subset the object
ggplot.profr(data, ..., minlabel = 0.1, angle = 0)
ggplot.profr(data, ..., minlabel = 0.1, angle = 0)
data |
profile output to plot |
... |
other arguments passed on to |
minlabel |
minimum percent of time for function to get a label |
angle |
function label angle |
if (require("ggplot2")) { ggplot(nesting_prof) ggplot(reshape_prof) }
if (require("ggplot2")) { ggplot(nesting_prof) ggplot(reshape_prof) }
Parses the output of Rprof
into an alternative format
described in profr
. This produces a flat data frame, which is
somewhat easier to summarise and visualise.
parse_rprof(path, interval = 0.02)
parse_rprof(path, interval = 0.02)
path |
path to |
interval |
real-time interval between samples (in seconds) |
data.frame
of class profr
profr
for profiling and parsing
nesting_ex <- system.file("samples", "nesting.rprof", package="profr") nesting <- parse_rprof(nesting_ex) reshape_ex <- system.file("samples", "reshape.rprof", package="profr") diamonds <- parse_rprof(reshape_ex)
nesting_ex <- system.file("samples", "nesting.rprof", package="profr") nesting <- parse_rprof(nesting_ex) reshape_ex <- system.file("samples", "reshape.rprof", package="profr") diamonds <- parse_rprof(reshape_ex)
profr
data.frame.If you only want a small part of the total call tree, you will need to subset the object as demonstrated by the example.
## S3 method for class 'profr' plot(x, ..., minlabel = 0.1, angle = 0)
## S3 method for class 'profr' plot(x, ..., minlabel = 0.1, angle = 0)
x |
profile output to plot |
... |
other arguments passed on to |
minlabel |
minimum percent of time for function to get a label |
angle |
function label angle |
plot(nesting_prof) plot(reshape_prof)
plot(nesting_prof) plot(reshape_prof)
This is a wrapper around Rprof
that provides results in an
alternative data structure, a data.frame. The columns of the data.frame
are:
profr(expr, interval = 0.02, quiet = TRUE)
profr(expr, interval = 0.02, quiet = TRUE)
expr |
expression to profile |
interval |
interval between samples (in seconds) |
quiet |
should output be discarded? |
name of function
level in call stack
total time (seconds) spent in function
time at which control entered function
time at which control exited function
TRUE
if the function is a terminal node in the call tree, i.e. didn't call any other functions
guess at the package that the function came from
data.frame
of class profr
parse_rprof
to parse standalone Rprof
file, plot.profr
and ggplot.profr
to visualise the profiling data
## Not run: glm_ex <- profr({Sys.sleep(1); example(glm)}, 0.01) head(glm_ex) summary(glm_ex) plot(glm_ex) ## End(Not run)
## Not run: glm_ex <- profr({Sys.sleep(1); example(glm)}, 0.01) head(glm_ex) summary(glm_ex) plot(glm_ex) ## End(Not run)
These two datasets illustrate the results of running
parse_rprof
on the sample Rprof
output stored in
the samples directory. The output was generated by the code in
samples/generate.r
.
nesting_prof reshape_prof
nesting_prof reshape_prof
a data frame