Description Usage Arguments Details Value Author(s) References See Also Examples
This is an interface to the C routine getrusage()
.
It fills in the fields in a C-level struct rusage
.
The C-level structure can be be supplied by the caller
or, alternatively, the default value of the x__usage
parameter provides a new instance of that object.
The C object can be used as is and the fields accessed from R,
or alternatively it can be copied to a rusage-class
object in R.
1 |
x__who |
either |
x__usage |
an object of class |
.copy |
a logical value indicating whether the
|
This is programmatically generated code using the
RGCCTranslationUnit
A list of length 2.
The first element is an integer giving the return value of the
C routine getrusage
. The second element
depends on the value of the .code
argument.
If this is .code = FALSE
, the second element
is an R object of class rusagePtr
which is a reference to the C-level structure passed
as the value for x__usage
.
If .copy
is TRUE, the second element is
an object of class rusage-class
which is an R-level copy of the C-level structure.
Duncan Temple Lang
Man page for getrusage
.
1 2 3 4 5 6 7 8 9 10 11 12 | start = getrusage(RUSAGE_SELF)
invisible(replicate(100, mean(rnorm(1000))))
end = getrusage(RUSAGE_SELF)
end$ru_time - start$ru_utime
end$ru_stime - start$ru_stime
# Get the result as a regular R-level object,
# not a reference to a C-level structure.
ru = getrusage(RUSAGE_SELF, .copy = TRUE)[[2]]
ru@majflt
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.