Learn R Programming

proftools (version 0.99-3)

filterProfileData: Filter Profile Data

Description

Allow profile data to be filtered on several criteria.

Usage

filterProfileData(pd, ..., normalize = FALSE, regex = FALSE)

Arguments

pd

profile data as returned by readProfileData.

...

filter specifications is filter = value form as described below.

normalize

logical; if true the total hit count is set to the total number of hits in the reduced profile data; otherwise the original value is retained.

regex

logical; if true the specifications in select, and omit, and focus filters are treated as regular expressions; otherwise exact matches are required.

Value

A reduced profile data structure.

Details

This function can be used to make plots and summaries more readable or relevant by removing functions that are not of direct interest or have low hit counts.

Filters are specified in filter = value form with value typically specifying a filter level or argument. Possible filters and their argument values are:

select

character vector specifying names of functions; call stacks not containing functions matching any of these names are dropped.

omit

character vector specifying names of functions; call stacks containing functions matching any of these names are dropped.

focus

character vector specifying names of functions; call stacks not containing functions matching any of these names are dropped, and functions at the bottom of the stack not matching the focus specification are dropped.

skip

integer; the number of elements to trim from the bottom of the stacks.

maxdepth

integer; stacks are truncated to have at most maxdepth elements.

self.pct

numeric; functions at the bottom of the stacks with self percentages below this value are removed.

total.pct

numeric; functions at the top of the stacks with total percentages below this value are removed.

interval

inter vector of length 2 specifying first and last sample to use.

merge.pct

numeric; functions at the top of the stacks are removed and stack traces merged until each retained trace accounts for at least this percentage of run time.

See Also

Rprof, summaryRprof, flatProfile, readProfileData, plotProfileCallGraph, profileCallGraph2Dot

Examples

Run this code
# NOT RUN {
pd <- readProfileData(system.file("samples", "glmEx.out", package="proftools"))
plotProfileCallGraph(pd)
plotProfileCallGraph(filterProfileData(pd, self.pct = 1))
plotProfileCallGraph(filterProfileData(pd, self.pct = 1, total.pct = 10))
plotProfileCallGraph(filterProfileData(pd, select = "glm", self.pct=1,
                                       total.pct=10))
# }

Run the code above in your browser using DataLab