detectActiveCores: Count Active Threads Based on CPU Usage
Description
This function counts the number of active system processes (threads) that
match a given pattern and exceed a specified minimum CPU usage threshold. It
works on Unix-like systems (e.g., Linux, macOS) and does not support Windows.
Usage
detectActiveCores(pattern = "", minCPU = 50)
Value
An integer representing the number of active threads matching the
pattern and exceeding the CPU usage threshold. Returns NULL with a
message if run on Windows.
Arguments
pattern
A character string used to filter process lines. Only
processes whose command line matches this pattern will be considered.
Default is "" (matches all).
minCPU
A numeric value specifying the minimum CPU usage (in percent)
for a process to be considered active. Default is 50.