Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
EricYangIBM committed May 6, 2022
1 parent 7b50477 commit e904299
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions port/unix/omrsysinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,17 +427,17 @@ typedef struct OMRCgroupMetricInfoElement {
BOOLEAN isValueToBeChecked;
} OMRCgroupMetricInfoElement;

static struct OMRCgroupMetricInfoElement oomControlMetricElementList[] = {
static struct OMRCgroupMetricInfoElement oomControlMetricElementListV1[] = {
{ "OOM Killer Disabled", "oom_kill_disable", NULL, FALSE },
{ "Under OOM", "under_oom", NULL, FALSE }
};

static struct OMRCgroupMetricInfoElement memEventsMetricElementList[] = {
static struct OMRCgroupMetricInfoElement memEventsMetricElementListV2[] = {
{ "Approached memory limit count", "max", NULL, FALSE },
{ "Reached memory limit count", "oom", NULL, FALSE }
};

static struct OMRCgroupMetricInfoElement swapEventsMetricElementList[] = {
static struct OMRCgroupMetricInfoElement swapEventsMetricElementListV2[] = {
{ "Approached swap limit count", "max", NULL, FALSE },
{ "Swap alloc failed count", "fail", NULL, FALSE }
};
Expand All @@ -448,7 +448,7 @@ static struct OMRCgroupMetricInfoElement cpuStatMetricElementListV1[] = {
{ "Total throttle time", "throttled_time", "nanoseconds", FALSE }
};

static struct OMRCgroupMetricInfoElement cpuMaxMetricElementList[] = {
static struct OMRCgroupMetricInfoElement cpuMaxMetricElementListV2[] = {
{ "CPU Quota", (char *)CGROUP_METRIC_NO_KEY, "microseconds", TRUE },
{ "CPU Period", (char *)CGROUP_METRIC_NO_KEY, "microseconds", FALSE }
};
Expand All @@ -474,7 +474,7 @@ static struct OMRCgroupSubsystemMetricMap omrCgroupMemoryMetricMapV1[] = {
{ "memory.memsw.max_usage_in_bytes", &(OMRCgroupMetricInfoElement){ "Memory + Swap Max Usage", NULL, "bytes", FALSE }, SINGLE_CGROUP_METRIC },
{ "memory.failcnt", &(OMRCgroupMetricInfoElement){ "Memory limit exceeded count", NULL, NULL, FALSE }, SINGLE_CGROUP_METRIC },
{ "memory.memsw.failcnt", &(OMRCgroupMetricInfoElement){ "Memory + Swap limit exceeded count", NULL, NULL, FALSE }, SINGLE_CGROUP_METRIC },
{ "memory.oom_control", &oomControlMetricElementList[0], sizeof(oomControlMetricElementList)/sizeof(oomControlMetricElementList[0]) }
{ "memory.oom_control", &oomControlMetricElementListV1[0], sizeof(oomControlMetricElementListV1)/sizeof(oomControlMetricElementListV1[0]) }
};
#define OMR_CGROUP_MEMORY_METRIC_MAP_V1_SIZE sizeof(omrCgroupMemoryMetricMapV1) / sizeof(omrCgroupMemoryMetricMapV1[0])

Expand All @@ -483,8 +483,8 @@ static struct OMRCgroupSubsystemMetricMap omrCgroupMemoryMetricMapV2[] = {
{ "memory.swap.max", &(OMRCgroupMetricInfoElement){ "Swap Limit", NULL, "bytes", TRUE }, SINGLE_CGROUP_METRIC },
{ "memory.current", &(OMRCgroupMetricInfoElement){ "Memory Usage", NULL, "bytes", FALSE }, SINGLE_CGROUP_METRIC },
{ "memory.swap.current", &(OMRCgroupMetricInfoElement){ "Swap Usage", NULL, "bytes", FALSE }, SINGLE_CGROUP_METRIC },
{ "memory.events", &memEventsMetricElementList[0], sizeof(memEventsMetricElementList)/sizeof(swapEventsMetricElementList[0]) },
{ "memory.swap.events", &swapEventsMetricElementList[0], sizeof(swapEventsMetricElementList)/sizeof(swapEventsMetricElementList[0]) }
{ "memory.events", &memEventsMetricElementListV2[0], sizeof(memEventsMetricElementListV2)/sizeof(memEventsMetricElementListV2[0]) },
{ "memory.swap.events", &swapEventsMetricElementListV2[0], sizeof(swapEventsMetricElementListV2)/sizeof(swapEventsMetricElementListV2[0]) }
};
#define OMR_CGROUP_MEMORY_METRIC_MAP_V2_SIZE sizeof(omrCgroupMemoryMetricMapV2) / sizeof(omrCgroupMemoryMetricMapV2[0])

Expand All @@ -497,7 +497,7 @@ static struct OMRCgroupSubsystemMetricMap omrCgroupCpuMetricMapV1[] = {
#define OMR_CGROUP_CPU_METRIC_MAP_V1_SIZE sizeof(omrCgroupCpuMetricMapV1) / sizeof(omrCgroupCpuMetricMapV1[0])

static struct OMRCgroupSubsystemMetricMap omrCgroupCpuMetricMapV2[] = {
{ "cpu.max", &cpuMaxMetricElementList[0], sizeof(cpuMaxMetricElementList)/sizeof(cpuMaxMetricElementList[0]) },
{ "cpu.max", &cpuMaxMetricElementListV2[0], sizeof(cpuMaxMetricElementListV2)/sizeof(cpuMaxMetricElementListV2[0]) },
{ "cpu.weight", &(OMRCgroupMetricInfoElement){ "CPU Weight relative to procs in same cgroup", NULL, NULL, FALSE }, SINGLE_CGROUP_METRIC },
{ "cpu.stat", &cpuStatMetricElementListV2[0], sizeof(cpuStatMetricElementListV2)/sizeof(cpuStatMetricElementListV2[0]) }
};
Expand Down Expand Up @@ -6797,11 +6797,11 @@ omrsysinfo_cgroup_subsystem_iterator_next(struct OMRPortLibrary *portLibrary, st
if (0 == strncmp(current, currentElement->metricKeyInFile, metricKeyLen)) {
char *newLine = current;
current += metricKeyLen;
/* advance past any whitespace */
/* Advance past any whitespace. */
while ((current != end) && (' ' == *current)) {
current += 1;
}
/* find the newline */
/* Find the newline. */
newLine = current;
while ('\n' != *newLine) {
newLine += 1;
Expand All @@ -6814,7 +6814,7 @@ omrsysinfo_cgroup_subsystem_iterator_next(struct OMRPortLibrary *portLibrary, st
}
current += 1;
}
/* if we complete parse the fileContent and couldn't find the metric return error code */
/* Return an error code if the metric is not found after completely parsing fileContent. */
if (!isMetricFound) {
rc = OMRPORT_ERROR_SYSINFO_CGROUP_SUBSYSTEM_METRIC_NOT_AVAILABLE;
}
Expand Down Expand Up @@ -6873,7 +6873,7 @@ omrsysinfo_cgroup_subsystem_iterator_next(struct OMRPortLibrary *portLibrary, st
"invalid value %s in file %s",
metricElement->value,
subsystemMetricMapElement->metricFileName);
} else if (UINT_MAX == uresult) {
} else if (UINT64_MAX == uresult) {
result = -1;
} else {
result = (int64_t)uresult;
Expand Down

0 comments on commit e904299

Please sign in to comment.