annotateSource {proftools}R Documentation

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.

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

## 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)

[Package proftools version 0.99-3 Index]