Skip to content

Commit

Permalink
Merge pull request eclipse-omr#2430 from ashu-mehra/update_get_memory…
Browse files Browse the repository at this point in the history
…_info

Update portlib API omrsysinfo_get_memory_info to use cgroup limits
  • Loading branch information
charliegracie authored Jul 16, 2018
2 parents 7993691 + 2a69761 commit 5d8e52c
Show file tree
Hide file tree
Showing 7 changed files with 309 additions and 43 deletions.
12 changes: 12 additions & 0 deletions include_core/omrport.h
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,18 @@ typedef struct J9MemoryInfo {
uint64_t cached; /* The physical RAM used as cache memory (in bytes). */
uint64_t buffered; /* The physical RAM used for file buffers (in bytes). */
int64_t timestamp; /* Sampling timestamp (in microseconds). */
/* Available physical memory on the host (in bytes) when process is in a cgroup.
* When not in a cgroup, this will be identical to 'availPhysical' field above.
*/
uint64_t hostAvailPhysical;
/* The physical RAM used as cache memory (in bytes) when process is in a cgroup.
* When not in a cgroup, this will be identical to 'cached' field above.
*/
uint64_t hostCached;
/* The physical RAM used for file buffers (in bytes) when process is in a cgroup.
* When not in a cgroup, this will be identical to 'buffered' field above.
*/
uint64_t hostBuffered;
} J9MemoryInfo;

#define OMRPORT_MEMINFO_NOT_AVAILABLE ((uint64_t) -1)
Expand Down
3 changes: 2 additions & 1 deletion include_core/omrporterror.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,9 @@
#define OMRPORT_ERROR_SYSINFO_SYS_FS_CGROUP_TMPFS_NOT_MOUNTED (OMRPORT_ERROR_SYSINFO_BASE-21)
#define OMRPORT_ERROR_SYSINFO_CGROUP_SUBSYSTEM_UNAVAILABLE (OMRPORT_ERROR_SYSINFO_BASE-22)
#define OMRPORT_ERROR_SYSINFO_CGROUP_NAME_NOT_AVAILABLE (OMRPORT_ERROR_SYSINFO_BASE-23)
#define OMRPORT_ERROR_SYSINFO_CGROUP_MEMLIMIT_FILE_FOPEN_FAILED (OMRPORT_ERROR_SYSINFO_BASE-24)
#define OMRPORT_ERROR_SYSINFO_CGROUP_SUBSYSTEM_FILE_FOPEN_FAILED (OMRPORT_ERROR_SYSINFO_BASE-24)
#define OMRPORT_ERROR_SYSINFO_CGROUP_MEMLIMIT_NOT_SET (OMRPORT_ERROR_SYSINFO_BASE-25)
#define OMRPORT_ERROR_SYSINFO_CGROUP_SUBSYSTEM_FILE_INVALID_VALUE (OMRPORT_ERROR_SYSINFO_BASE-26)

/**
* @name Port library initialization return codes
Expand Down
3 changes: 3 additions & 0 deletions port/common/omrport.tdf
Original file line number Diff line number Diff line change
Expand Up @@ -1077,3 +1077,6 @@ TraceException=Trc_PRT_readCgroupFile_fgets_failed Group=sysinfo Overhead=1 Leve
TraceException=Trc_PRT_isRunningInContainer_fgets_failed Group=sysinfo Overhead=1 Level=3 NoEnv Template="isRunningInContainer: unexpected format of file %s with errno=%d"

TraceException=Trc_PRT_signal_mapPortLibSignalToOSSignal_ERROR_unknown_signal Group=signal Overhead=1 Level=3 NoEnv Template="omrsignal: mapPortLibSignalToOSSignal: ERROR, unknown signal, portLibSignal=0x%X"

TraceException=Trc_PRT_retrieveLinuxCgroupMemoryStats_invalidValue Group=sysinfo Overhead=1 Level=1 NoEnv Template="retrieveLinuxCgroupMemoryStats: Value of field \"%s\" in file %s is invalid"
TraceEvent=Trc_PRT_retrieveLinuxMemoryStats_CgroupMemoryStatsFailed Group=sysinfo Overhead=1 Level=1 NoEnv Template="retrieveLinuxMemoryStats: Failed to retrieve memory stats of cgroup with error code=%d"
Loading

0 comments on commit 5d8e52c

Please sign in to comment.