private List<OSProcess> getCurrentProcessAndChildProcesses() {
    final List<OSProcess> processes = new ArrayList<>();
    // get current process
    processes.add(os.getProcess(os.getProcessId()));
    // get all child processes of current process
    processes.addAll(os.getChildProcesses(os.getProcessId(), OperatingSystem.ProcessFiltering.ALL_PROCESSES,
        OperatingSystem.ProcessSorting.NO_SORTING, 0));
    return processes;
  }
An implementation of {@link SystemStatisticsGetter} that relies on using oshi framework(https://www.oshi.ooo/)

This class captures the recent cpu usage percentage(in the [0, 100] interval) used by the Samza container process and
its child processes. It gets CPU usage of this process since a previous snapshot of the same process, the snapshot is
triggered by last poll, have polling interval of at least a few seconds is recommended.
samza-core/src/main/java/org/apache/samza/container/host/OshiBasedStatisticsGetter.java