From a8d230b697cb960ff7ef41b0bf0f3ef48573c61e Mon Sep 17 00:00:00 2001 From: Gengchen Tuo Date: Wed, 22 Nov 2023 10:31:42 -0500 Subject: [PATCH] Make omrsysinfo_get_CPU_load() return another error code on first call This is to help getSystemCpuLoad() determine if it's the first call. Related: https://github.com/eclipse-openj9/openj9/pull/18451 Signed-off-by: Gengchen Tuo --- include_core/omrporterror.h | 1 + port/unix/omrsysinfo.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include_core/omrporterror.h b/include_core/omrporterror.h index feeeee5ba06..c5e8fb0ad34 100644 --- a/include_core/omrporterror.h +++ b/include_core/omrporterror.h @@ -67,6 +67,7 @@ #define OMRPORT_ERROR_INVALID_HANDLE (OMRPORT_ERROR_BASE-17) #define OMRPORT_ERROR_NOT_SUPPORTED_ON_THIS_PLATFORM (OMRPORT_ERROR_BASE-18) #define OMRPORT_ERROR_INVALID_ARGUMENTS (OMRPORT_ERROR_BASE-19) +#define OMRPORT_ERROR_INSUFFICIENT_DATA (OMRPORT_ERROR_BASE-20) /** @} */ /** diff --git a/port/unix/omrsysinfo.c b/port/unix/omrsysinfo.c index 2fa15bd651f..83665ce5288 100644 --- a/port/unix/omrsysinfo.c +++ b/port/unix/omrsysinfo.c @@ -4642,7 +4642,7 @@ omrsysinfo_get_CPU_load(struct OMRPortLibrary *portLibrary, double *cpuLoad) if (oldestCPUTime->timestamp == 0) { *oldestCPUTime = currentCPUTime; *latestCPUTime = currentCPUTime; - return OMRPORT_ERROR_OPFAILED; + return OMRPORT_ERROR_INSUFFICIENT_DATA; } /* Calculate using the most recent value in the history */