Learn R Programming

proftools (version 0.99-3)

annotateSource: Annotate Source Files

Description

Annotates source files with profile information.

Usage

annotateSource(pd, value = c("pct", "time", "hits"), GC = TRUE,
               sep = ":  ", show = TRUE, ...)

Arguments

pd

profile data as returned by readProfileData.

value

character; show result as percentage, time, or hits.

GC

logical; include GC information or not.

sep

character; separator between profile info and source lines.

show

logical; if true, show files with file.show.

...

additional arguments for file.show.

Value

A list of character vectors of the annotated file lines.

Details

For lines that appear in the stack trace the percent time and, optionally, GC time are shown before each line.

See Also

Rprof, summaryRprof, flatProfile, filterProfileData, readProfileData, srcSummary

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
Rprof(tmp <- tempfile(), gc.profiling = TRUE, line.profiling = TRUE)
w <- rw(200000)
Rprof(NULL)
pd <- readProfileData(tmp)
unlink(tmp)

## Annotate the sources
annotateSource(pd)
# }

Run the code above in your browser using DataLab