Title: | Help use collectl with R in Linux, to measure resource consumption in R processes |
---|---|
Description: | Provide functions to obtain instrumentation data on processes in a unix environment. Parse output of a collectl run. Vizualize aspects of system usage over time, with annotation. |
Authors: | Vincent Carey [aut, cre] , Yubo Cheng [aut] |
Maintainer: | Vincent Carey <[email protected]> |
License: | Artistic-2.0 |
Version: | 1.7.0 |
Built: | 2024-11-27 05:56:37 UTC |
Source: | https://github.com/bioc/Rcollectl |
browse a page defining units of collectl reporting
browse_units(...)
browse_units(...)
... |
passed to browseURL |
side effect is running browseURL
if (interactive()) { browse_units() }
if (interactive()) { browse_units() }
check for collectl availability
cl_exists()
cl_exists()
logical(1)
cl_exists()
cl_exists()
parse a collectl output – could be conditional on discovered call
cl_parse(path, tz = "EST", rescale_mem = TRUE)
cl_parse(path, tz = "EST", rescale_mem = TRUE)
path |
character(1) path to (possibly gzipped) collectl output |
tz |
character(1) POSIXct time zone code, defaults to "EST" |
rescale_mem |
logical(1) if TRUE, divide reported MEM_Used by 1000 |
a data.frame
A lubridate datetime is added as a column. The test file demo_1123.tab.gz
is
a collectl-generated report for a session ranging over 10 minutes, analyzing RNA-seq data
on a multicore machine.
lk = cl_parse(system.file("demotab/demo_1123.tab.gz", package="Rcollectl")) head(lk)
lk = cl_parse(system.file("demotab/demo_1123.tab.gz", package="Rcollectl")) head(lk)
get full path to collectl report
cl_result_path(proc)
cl_result_path(proc)
proc |
an entity inheriting from "Rcollectl_process" S3 class |
character(1) path to report
example(cl_start)
example(cl_start)
start collectl if possible
cl_start(target = tempfile())
cl_start(target = tempfile())
target |
character(1) path; destination of collectl report |
instance of Rcollectl_process
with components process
(a processx R6 instance) and
target
(a file path where collectl results will be written)
if (cl_exists()) { zz = cl_start() Sys.sleep(2) print(zz) Sys.sleep(2) print(cl_result_path(zz)) cl_stop(zz) Sys.sleep(2) zz$process$is_alive() }
if (cl_exists()) { zz = cl_start() Sys.sleep(2) print(zz) Sys.sleep(2) print(cl_result_path(zz)) cl_stop(zz) Sys.sleep(2) zz$process$is_alive() }
stop collectl via processx interrupt
cl_stop(proc)
cl_stop(proc)
proc |
an entity inheriting from "Rcollectl_process" S3 class |
invisibly returns the input
example(cl_start)
example(cl_start)
Functions to add time stamps to collectl output
cl_timestamp(proc, step) cl_timestamp_layer(arg) cl_timestamp_label(arg, tz = "EST")
cl_timestamp(proc, step) cl_timestamp_layer(arg) cl_timestamp_label(arg, tz = "EST")
proc |
an entity inheriting from "Rcollectl_process" S3 class |
step |
character(1) name of step within a workflow |
arg |
proc (an entity inheriting from "Rcollectl_process" S3 class) or path to collectl output |
tz |
character(1) time zone code |
cl_timestamp()
returns a tab delimited text file
cl_timestamp_layer()
and cl_timestamp_label()
return objects that can be combined with ggplot.
id <- cl_start() Sys.sleep(2) cl_timestamp(id, "step1") Sys.sleep(2) Sys.sleep(2) cl_timestamp(id, "step2") Sys.sleep(2) Sys.sleep(2) cl_timestamp(id, "step3") Sys.sleep(2) cl_stop(id) path <- cl_result_path(id) plot_usage(cl_parse(path)) + cl_timestamp_layer(path) + cl_timestamp_label(path) + ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 90, vjust = 0.5, hjust=1))
id <- cl_start() Sys.sleep(2) cl_timestamp(id, "step1") Sys.sleep(2) Sys.sleep(2) cl_timestamp(id, "step2") Sys.sleep(2) Sys.sleep(2) cl_timestamp(id, "step3") Sys.sleep(2) cl_stop(id) path <- cl_result_path(id) plot_usage(cl_parse(path)) + cl_timestamp_layer(path) + cl_timestamp_label(path) + ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 90, vjust = 0.5, hjust=1))
elementary display of usage data from collectl
plot_usage(x)
plot_usage(x)
x |
output of cl_parse |
ggplot with geom_point and facet_grid
lk = cl_parse(system.file("demotab/demo_1123.tab.gz", package="Rcollectl")) plot_usage(lk)
lk = cl_parse(system.file("demotab/demo_1123.tab.gz", package="Rcollectl")) plot_usage(lk)
print method for Rcollectl process
## S3 method for class 'Rcollectl_process' print(x, ...)
## S3 method for class 'Rcollectl_process' print(x, ...)
x |
an entity inheriting from "Rcollectl_process" S3 class |
... |
not used |
invisibly returns the input
example(cl_start)
example(cl_start)