
Benchmark Execution Runtime and Memory Usage
Source:R/08_metrics_scalability.R
benchmark_resource_usage.RdTimes an expression and measures change in memory allocation, computing both raw
runtime/memory metrics and core-normalized Category VIII scalability indicators
(core_seconds and memory_per_core_mib).
Value
A named list containing the evaluated expression result and resource metrics:
resultReturn value of
expr(orNULLif evaluation errored).core_secondsTotal CPU core-seconds (
elapsed_seconds * cores).core_hoursTotal CPU core-hours (
core_seconds / 3600).memory_per_core_mibPeak R heap memory per allocated core in MiB.
memory_per_core_gibPeak R heap memory per allocated core in GiB.
memory_per_core_mbPeak R heap memory per allocated core in decimal MB.
memory_per_core_gbPeak R heap memory per allocated core in decimal GB.
elapsed_secondsWall-clock elapsed runtime in seconds.
elapsed_minutesWall-clock elapsed runtime in minutes.
memory_mbPeak R heap memory allocated in MiB.
memory_mibAlias of
memory_mbin MiB.memory_mb_siPeak R heap memory allocated in decimal MB.
sim_coresNormalized integer core count (included only when
sim_coresis supplied).
References
Lannelongue, L., et al. (2021). Green Algorithms. Advanced Science, 8(12), 2100707. Holtgrewe, M., et al. (2015). Bioinformatics, 31(12), 1904–1912.
Examples
benchmark_resource_usage({ Sys.sleep(0.01); 1 + 1 })
#> $result
#> [1] 2
#>
#> $core_seconds
#> [1] 0.03
#>
#> $core_hours
#> [1] 8.333333e-06
#>
#> $memory_per_core_mib
#> [1] 742.8
#>
#> $memory_per_core_gib
#> [1] 0.7253906
#>
#> $memory_per_core_mb
#> [1] 778.8823
#>
#> $memory_per_core_gb
#> [1] 0.7788823
#>
#> $elapsed_seconds
#> [1] 0.03
#>
#> $elapsed_minutes
#> [1] 5e-04
#>
#> $memory_mb
#> [1] 742.8
#>
#> $memory_mib
#> [1] 742.8
#>
#> $memory_mb_si
#> [1] 778.8823
#>