annotateSource: Annotate Source Files

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/prof.R

Description

Annotates source files with profile information.

Usage

1
2
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.

Details

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

Value

A list of character vectors of the annotated file lines.

Author(s)

Luke Tierney

See Also

Rprof, summaryRprof, flatProfile, filterProfileData, readProfileData, srcSummary

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## 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)

Example output



proftools documentation built on July 8, 2020, 5:20 p.m.