HenrikBengtsson / profmem

🔧 R package: profmem - Simple Memory Profiling for R
https://cran.r-project.org/package=profmem
35 stars 2 forks source link

DOCS: Document the Rprofmem data.frame #15

Closed HenrikBengtsson closed 5 years ago

HenrikBengtsson commented 5 years ago

Add more details on what an Rprofmem data.frame contains:

Reminder:

> p <- profmem::profmem({ x <- integer(1e4); y <- foo(1e6) })
> p
Rprofmem memory profiling of:
{
    x <- integer(10000)
    y <- foo(1e+06)
}

Memory allocations:
       what   bytes              calls
1     alloc   40048          integer()
2     alloc 4000048 foo() -> integer()
total       4040096                   
> str(p)
Classes 'Rprofmem' and 'data.frame':    2 obs. of  3 variables:
 $ what : chr  "alloc" "alloc"
 $ bytes: num  4e+04 4e+06
 $ trace:List of 2
  ..$ : chr "integer"
  ..$ : chr  "integer" "foo"
 - attr(*, "threshold")= int 0
 - attr(*, "expression")= language {  x <- integer(10000); y <- foo(1e+06) }
  ..- attr(*, "srcref")=List of 3
  .. ..$ : 'srcref' int  1 23 1 23 23 23 1 1
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x556b805fa4e0> 
  .. ..$ : 'srcref' int  1 25 1 41 25 41 1 1
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x556b805fa4e0> 
  .. ..$ : 'srcref' int  1 44 1 56 44 56 1 1
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x556b805fa4e0> 
  ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x556b805fa4e0> 
  ..- attr(*, "wholeSrcref")= 'srcref' int  1 0 1 58 0 58 1 1
  .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x556b805fa4e0> 
 - attr(*, "value")= int  0 0 0 0 0 0 0 0 0 0 ...