Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Backport a0b687b
Browse files Browse the repository at this point in the history
  • Loading branch information
kvergizova committed Dec 22, 2020
1 parent ead24ad commit 7a1c3b0
Showing 1 changed file with 25 additions and 34 deletions.
Expand Up @@ -184,41 +184,35 @@ private static void createSubSystem(Metrics metric, String[] mountentry) {
* setSubSystemPath based on the contents of /proc/self/cgroup
*/
private static void setSubSystemPath(Metrics metric, String[] entry) {
String controller;
String base;
SubSystem subsystem = null;
SubSystem subsystem2 = null;

controller = entry[1];
base = entry[2];
String controller = entry[1];
String base = entry[2];
if (controller != null && base != null) {
switch (controller) {
case "memory":
subsystem = metric.MemorySubSystem();
break;
case "cpuset":
subsystem = metric.CpuSetSubSystem();
break;
case "cpu,cpuacct":
case "cpuacct,cpu":
subsystem = metric.CpuSubSystem();
subsystem2 = metric.CpuAcctSubSystem();
break;
case "cpuacct":
subsystem = metric.CpuAcctSubSystem();
break;
case "cpu":
subsystem = metric.CpuSubSystem();
break;
case "blkio":
subsystem = metric.BlkIOSubSystem();
break;
// Ignore subsystems that we don't support
default:
break;
for (String cName: controller.split(",")) {
switch (cName) {
case "memory":
setPath(metric, metric.MemorySubSystem(), base);
break;
case "cpuset":
setPath(metric, metric.CpuSetSubSystem(), base);
break;
case "cpuacct":
setPath(metric, metric.CpuAcctSubSystem(), base);
break;
case "cpu":
setPath(metric, metric.CpuSubSystem(), base);
break;
case "blkio":
setPath(metric, metric.BlkIOSubSystem(), base);
break;
// Ignore subsystems that we don't support
default:
break;
}
}
}
}

private static void setPath(Metrics metric, SubSystem subsystem, String base) {
if (subsystem != null) {
subsystem.setPath(base);
if (subsystem instanceof MemorySubSystem) {
Expand All @@ -230,9 +224,6 @@ private static void setSubSystemPath(Metrics metric, String[] entry) {
}
metric.setActiveSubSystems();
}
if (subsystem2 != null) {
subsystem2.setPath(base);
}
}


Expand Down

0 comments on commit 7a1c3b0

Please sign in to comment.