flatProfile: Flat Profile for Rprof Profile Data

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

View source: R/proftools.R

Description

Computes a flat profile reflecting time spent in functions themselves (self) and functions plus callees (total).

Usage

1
flatProfile(pd, byTotal = TRUE, GC = TRUE)

Arguments

pd

profile data as returned by readProfileData.

byTotal

logical; sort by total time if true, self time if not.

GC

logical; include GC information or not.

Details

If byTotal is true then the result is analogous to the by.total component of the result returned by summaryRprof. Otherwise, the result is analogous to the by.self component returned by summaryRprof but with an additional cumulative self times column. The result returned when byTotal is not true is analogous to the flat profile produced by gprof.

Value

A matrix with one row per function recorded in the profile data.

Author(s)

Luke Tierney

References

User manual for gprof, the GNU profiler.

See Also

Rprof, summaryRprof, readProfileData, plotProfileCallGraph, printProfileCallGraph, profileCallGraph2Dot

Examples

1
2
3
pd <- readProfileData(system.file("samples", "glmEx.out", package="proftools"))
flatProfile(pd)
flatProfile(pd, FALSE)

Example output

                      total.pct total.time self.pct self.time
FUN                         100       0.50        4      0.02
lapply                      100       0.50        0      0.00
replicate                   100       0.50        0      0.00
sapply                      100       0.50        0      0.00
system.time                 100       0.50        0      0.00
summary                      80       0.40        0      0.00
glm                          76       0.38        0      0.00
eval                         68       0.34        0      0.00
glm.fit                      36       0.18        8      0.04
%in%                         28       0.14        4      0.02
deparse                      28       0.14       16      0.08
match                        28       0.14        0      0.00
paste                        28       0.14        0      0.00
<Anonymous>                  24       0.12        0      0.00
mode                         24       0.12        4      0.02
model.frame.default          24       0.12        0      0.00
data.frame                   16       0.08        0      0.00
dev.resids                   16       0.08        0      0.00
ifelse                       16       0.08       12      0.06
as.data.frame                12       0.06        0      0.00
as.data.frame.numeric        12       0.06        0      0.00
force                        12       0.06        0      0.00
::                            8       0.04        0      0.00
.deparseOpts                  8       0.04        4      0.02
.External2                    8       0.04        4      0.02
$                             8       0.04        8      0.04
getExportedValue              8       0.04        0      0.00
model.matrix                  8       0.04        0      0.00
model.matrix.default          8       0.04        0      0.00
[                             4       0.02        4      0.02
[[                            4       0.02        0      0.00
[[.data.frame                 4       0.02        0      0.00
as.name                       4       0.02        4      0.02
asNamespace                   4       0.02        0      0.00
exists                        4       0.02        4      0.02
getInternalExportName         4       0.02        0      0.00
getNamespace                  4       0.02        0      0.00
is.atomic                     4       0.02        4      0.02
is.na                         4       0.02        4      0.02
length                        4       0.02        4      0.02
mu.eta                        4       0.02        4      0.02
na.omit                       4       0.02        0      0.00
na.omit.data.frame            4       0.02        0      0.00
names                         4       0.02        4      0.02
simplify2array                4       0.02        0      0.00
summary.glm                   4       0.02        0      0.00
unique                        4       0.02        0      0.00
unique.default                4       0.02        4      0.02
                      self.pct cum.self.time self.time total.pct total.time
deparse                     16          0.08      0.08        28       0.14
ifelse                      12          0.14      0.06        16       0.08
$                            8          0.18      0.04         8       0.04
glm.fit                      8          0.22      0.04        36       0.18
.deparseOpts                 4          0.24      0.02         8       0.04
.External2                   4          0.26      0.02         8       0.04
[                            4          0.28      0.02         4       0.02
%in%                         4          0.30      0.02        28       0.14
as.name                      4          0.32      0.02         4       0.02
exists                       4          0.34      0.02         4       0.02
FUN                          4          0.36      0.02       100       0.50
is.atomic                    4          0.38      0.02         4       0.02
is.na                        4          0.40      0.02         4       0.02
length                       4          0.42      0.02         4       0.02
mode                         4          0.44      0.02        24       0.12
mu.eta                       4          0.46      0.02         4       0.02
names                        4          0.48      0.02         4       0.02
unique.default               4          0.50      0.02         4       0.02
::                           0          0.50      0.00         8       0.04
[[                           0          0.50      0.00         4       0.02
[[.data.frame                0          0.50      0.00         4       0.02
<Anonymous>                  0          0.50      0.00        24       0.12
as.data.frame                0          0.50      0.00        12       0.06
as.data.frame.numeric        0          0.50      0.00        12       0.06
asNamespace                  0          0.50      0.00         4       0.02
data.frame                   0          0.50      0.00        16       0.08
dev.resids                   0          0.50      0.00        16       0.08
eval                         0          0.50      0.00        68       0.34
force                        0          0.50      0.00        12       0.06
getExportedValue             0          0.50      0.00         8       0.04
getInternalExportName        0          0.50      0.00         4       0.02
getNamespace                 0          0.50      0.00         4       0.02
glm                          0          0.50      0.00        76       0.38
lapply                       0          0.50      0.00       100       0.50
match                        0          0.50      0.00        28       0.14
model.frame.default          0          0.50      0.00        24       0.12
model.matrix                 0          0.50      0.00         8       0.04
model.matrix.default         0          0.50      0.00         8       0.04
na.omit                      0          0.50      0.00         4       0.02
na.omit.data.frame           0          0.50      0.00         4       0.02
paste                        0          0.50      0.00        28       0.14
replicate                    0          0.50      0.00       100       0.50
sapply                       0          0.50      0.00       100       0.50
simplify2array               0          0.50      0.00         4       0.02
summary                      0          0.50      0.00        80       0.40
summary.glm                  0          0.50      0.00         4       0.02
system.time                  0          0.50      0.00       100       0.50
unique                       0          0.50      0.00         4       0.02

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