| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/readRprofmem.R |
| 3 |
\name{readRprofmem} |
| 4 |
\alias{readRprofmem} |
| 5 |
\title{Read an Rprofmem log file} |
| 6 |
\usage{ |
| 7 |
readRprofmem(pathname, as = c("Rprofmem", "fixed", "raw"), drop = 0L, ...) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{pathname}{The Rprofmem log file to be read.} |
| 11 |
|
| 12 |
\item{as}{Specifies in what format data should be returned. |
| 13 |
If \code{"raw"}, the line content of the file is returned as is |
| 14 |
(as a character vector). |
| 15 |
If \code{"fixed"}, as \code{"raw"} but with missing newlines added to lines with empty |
| 16 |
stack calls that may be introduced in R (< 3.5.0) (see Ref. 1). |
| 17 |
If \code{"Rprofmem"}, the collected Rprofmem data is fully |
| 18 |
parsed into bytes and call stack information.} |
| 19 |
|
| 20 |
\item{drop}{Number of levels to drop from the top of the call stack.} |
| 21 |
|
| 22 |
\item{...}{Not used} |
| 23 |
} |
| 24 |
\value{ |
| 25 |
An \code{Rprofmem} data.frame or a character vector (if \code{as} is \code{"raw"} |
| 26 |
or \code{"fixed"}). |
| 27 |
An \code{Rprofmem} data.frame has columns \code{what}, \code{bytes}, and \code{trace}, with: |
| 28 |
\itemize{ |
| 29 |
\item \code{what}: (character) type of memory event; |
| 30 |
either \code{"alloc"} or \code{"new page"} |
| 31 |
\item \code{bytes}: (numeric) number of bytes allocated or \code{NA_real_} |
| 32 |
(when \code{what} is \code{"new page"}) |
| 33 |
\item \code{trace}: (list of character vectors) zero or more function names |
| 34 |
} |
| 35 |
} |
| 36 |
\description{ |
| 37 |
Reads and parses an Rprofmem log file that was created by |
| 38 |
\code{\link[utils:Rprofmem]{utils::Rprofmem()}}. |
| 39 |
} |
| 40 |
\examples{ |
| 41 |
file <- system.file("extdata", "example.Rprofmem.out", package = "profmem") |
| 42 |
|
| 43 |
raw <- readRprofmem(file, as = "raw") |
| 44 |
cat(raw, sep = "\n") |
| 45 |
|
| 46 |
profmem <- readRprofmem(file, as = "Rprofmem") |
| 47 |
print(profmem) |
| 48 |
} |
| 49 |
\references{ |
| 50 |
Ref. 1: \url{https://github.com/HenrikBengtsson/Wishlist-for-R/issues/25} |
| 51 |
} |