java.lang.Object
org.apache.druid.java.util.metrics.cgroups.CpuSet

public class CpuSet extends Object
Collect CPU and memory data from cpuset cgroup files.
  • Constructor Details

  • Method Details

    • snapshot

      public CpuSet.CpuSetMetric snapshot()
      Take a snapshot of cpuset cgroup data
      Returns:
      A snapshot with the data populated.
    • parseStringRangeToIntArray

      public static int[] parseStringRangeToIntArray(String line)
      Parses the cpuset list format and outputs it as a list of CPUs. Examples: 0-4,9 # bits 0, 1, 2, 3, 4, and 9 set # outputs [0, 1, 2, 3, 4, 9] 0-2,7,12-14 # bits 0, 1, 2, 7, 12, 13, and 14 set # outputs [0, 1, 2, 7, 12, 13, 14] This method also works fine for memory nodes. The format is identical in both cgroups v1 and v2, so this can be shared.
      Parameters:
      line - The list format cpu value
      Returns:
      the list of CPU IDs