Skip to content

Commit

Permalink
Make omrsysinfo_get_CPU_load() return another error code on first call
Browse files Browse the repository at this point in the history
This is to help getSystemCpuLoad() determine if it's the first call.

Related: eclipse-openj9/openj9#18451

Signed-off-by: Gengchen Tuo <[email protected]>
  • Loading branch information
thallium committed Nov 22, 2023
1 parent 419dc95 commit a8d230b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions include_core/omrporterror.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
/** @} */

/**
Expand Down
2 changes: 1 addition & 1 deletion port/unix/omrsysinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit a8d230b

Please sign in to comment.