Description Usage Arguments Details Value Author(s) References See Also Examples
Read a log of stack entries, such as the output of the Rprof
function, and generate a more accessible representation.
1 2 3 4 |
filename |
Name of a file produced by |
chunksize |
Number of lines to read at a time. |
interval |
Real number: time interval between samples, in s.
Defaults to 0.02s for consistency with |
head |
|
id |
An optional identification string. Defaults to filename and date. |
This function reads a log file of stacks, one stack snapshot per line, stack entries separated by space.
As profiling output file could be very large, it
is read in blocks of chunksize
lines. Increasing chunksize
will make the function run faster if sufficient memory is available.
(This data structure is subject to change.)
The input format is controlled by the head
argument. Format "auto"
tries to detect control lines as interspersed by Rprof
. These lines are not included in the output.
"none"
ignores all control information and includes these lines as strange stacks.
"Rprofmem"
isolates headers as provided by Rprofmem
. "Rprofmem"
new page
entries are encoded as malloc
requests with length 0.
This data structure is subject to change.
Temporarily: A list with components
info |
Summary information. |
nodes |
A vector of node names. This may include stray entries from interspersed lines. |
stacks |
Stacks, represented as reference list to nodes, and stack frequencies. |
profiles |
Recorded data, as reference to stacks, and possibly additional data per reference. |
nodes
is (conceptually) a data frame with entries
name | node name |
self.time | nr of events with node as terminal leaf |
self.time | proportion of self.time with node as terminal leaf |
total.time | nr of events with node in stack |
self.time | proportion of total time with node as terminal leaf |
nr.runs | number of runs, over all run lengths and levels |
nr.runs | average of run length, over all run lengths and levels |
icol | current colour index |
Günther Sawitzki <gsawitzki@users.r-forge.r-project.org>, based on the code of summaryRprof
http://sintro.r-forge.r-project.org/
flatProfile
in library(proftools)
.
parse_rprof
in library(profr)
.
The chapter on “Tidying and profiling R code” in “Writing R Extensions” (see the ‘doc/manual’ subdirectory of the R source tree).
Rprof
is a sampling profiler.
tracemem
traces copying of an object via the C function duplicate
.
Rprofmem
is a non-sampling memory-use profiler.
http://developer.r-project.org/memory-profiling.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Not run:
## Rprof() is not available on all platforms
profinterval <- 0.001
simruns <- 100
n <- 10000
x <- runif(n)
y0 <- 2+ 3 * x
sinknull <- textConnection(NULL, "w"); sink(sinknull)
Rprof(tmp <- tempfile(), interval = profinterval)
for (i in 1:simruns) {y <- y0 + rnorm(n); xxx<- summary(lm(y~x))}
Rprof()
Rprof_out <- readRprof(tmp)
unlink(tmp)
sink(); close(sinknull)
str(Rprof_out)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.