Learn R Programming

proftools (version 0.99-3)

profileExpr: Read Rprof Profile Data

Description

Return profile data collected while evaluating an expression.

Usage

profileExpr(expr, GC = TRUE, srclines = TRUE, memory = TRUE)

Arguments

expr

Valid R expression to be profiled.

srclines

logical; include source information, if available, or not.

GC

logical; include GC information or not.

memory

logical; include memory use information or not.

Value

R representation of Rprof data.

Details

profileExpr uses Rprof to profile execution of expr and returns the profile data read in using readProfileData. By default GC and source information are included in the profile data. If memory profiling is supported, memory use information is also included by default.

See Also

Rprof, funSummary, srcSummary, plotProfileCallGraph,

Examples

Run this code
# NOT RUN {
## This defines the function rw()
source(system.file("samples", "rw.R", package="proftools"))

## Execute the function and collect profile data
pd <- profileExpr(rw(200000))

## Examine the profiel data
funSummary(pd)
callSummary(pd)
hotPaths(pd)
srcSummary(pd)
plotProfileCallGraph(pd)
# }

Run the code above in your browser using DataLab