Repository navigation
Implement RSSReport class - #7349
Conversation
gita-omr
commented
May 27, 2024
- Implement a class that can monitor RSS status of any number of arbitry memory regions
- In addition to start address and size, region can have name, as well as a list of items describing its content
|
Fixed white spaces. |
|
Removed Options.hpp include since it's not needed. |
|
Build fixes. |
|
Fix for windows build. |
|
Another Windows build fix. |
|
More Windows build fixes. |
|
Another Windows warning. |
|
another warning |
|
Corrected second commit |
|
I will fix line endings together with PR comments. |
|
Fixed Mac build and line endings. |
|
I still need to write a brief document for it. |
|
Small correction in the doc. |
|
Doc looks ok to me; after Daryl's taken a look, could you squash the extra "fix" commits? |
| } | ||
|
|
||
| #ifdef LINUX | ||
| typedef struct __attribute__ ((__packed__)) |
There was a problem hiding this comment.
Can you confirm this attribute will work on all Linux build compilers supported by OMR (https://github.com/eclipse/omr/blob/master/doc/SupportedC%2B%2BFeatures.md#minimum-compiler-support)?
I'm pretty sure packed is supported for gcc and Clang, but I'm less sure about the commercial xlC (not the one based on Clang) that we list as a supported compiler for OMR. It might work, but please confirm.
If not, you'll have to add some GNU and Clang ifdefs around it.
There was a problem hiding this comment.
The document does not mention packed. Can we assume all compilers support it? Otherwise, I am not sure how to check all of them. @0xdaryl
There was a problem hiding this comment.
Presumably, that attribute is required for efficiency rather than correctness. If so, then I think guarding the typedef using #ifdef compiler macros just like in the example here should suffice:
https://github.com/eclipse/omr/blob/d58019eba46edbd5f2e1963e687a27c1dbaccac0/compiler/infra/String.hpp#L31
The #else part could just be a typedef without the attribute. However, if the attribute is required for correctness for some reason then put an #error in the #else part instead.
There was a problem hiding this comment.
The attribute is needed for correctness. If some compiler does not support it I think it will give an error. Also, I noticed this attribute is being used in openj9 without any compiler check.
There was a problem hiding this comment.
OK, I don't think there are any non-Clang or non-gcc based compilers building and testing OMR. The reference to xlC 12 in the supported compilers list is a bit dated, and we actually plan on revisiting that list at the next OMR architecture meeting. Newer xlC's are based on Clang, I believe. So I'll let this go.
| { | ||
| if ((regionNum * REGION_PRINT_WIDTH + 1) < MAX_RSS_LINE) | ||
| { | ||
| sprintf(rssLine + regionNum * REGION_PRINT_WIDTH, "%*.*s", REGION_PRINT_WIDTH, REGION_PRINT_WIDTH, rssRegion->_name); |
There was a problem hiding this comment.
sprintf has been causing grief with newer build compilers due to potential overflow issues being flagged as errors. I think it's best not to introduce new uses and just go with snprintf instead.
See #6863 and a comment from Devin on some ways of consolidating snprintf behaviour across compilers: #6863 (comment)
There was a problem hiding this comment.
Replaced sprintf with TR::snprintfTrunc.
| { | ||
| if ((regionNum * REGION_PRINT_WIDTH + 1) < MAX_RSS_LINE) | ||
| { | ||
| sprintf(rssLine + regionNum * REGION_PRINT_WIDTH, "%*p", REGION_PRINT_WIDTH, rssRegion->_start); |
There was a problem hiding this comment.
snprintf, see earlier comment.
There was a problem hiding this comment.
Replaced sprintf with TR::snprintfTrunc.
|
|
||
| if ((regionNum * REGION_PRINT_WIDTH + 1) < MAX_RSS_LINE) | ||
| { | ||
| sprintf(rssLine + regionNum * REGION_PRINT_WIDTH, " %5zu/%5zu(%3.0f%%)", rssSizeKb, sizeKb, (float)rssSizeKb*100.0/sizeKb); |
There was a problem hiding this comment.
snprintf, see earlier comment.
There was a problem hiding this comment.
Replaced sprintf with TR::snprintfTrunc.
| if ((pageCount * PAGE_PRINT_WIDTH + PAGE_PRINT_WIDTH + 1) < MAX_RSS_LINE) | ||
| { | ||
| // Note: TR_VerboseLog will truncate the line to some maximum | ||
| sprintf(pagesInfo + pageCount * PAGE_PRINT_WIDTH, "%1zu ", resident); |
There was a problem hiding this comment.
snprintf, see earlier comment.
There was a problem hiding this comment.
Replaced sprintf with TR::snprintfTrunc.
|
Replaced |
|
Rebased |
|
Corrected and improved latest commit. |
Sure. I have not squashed yet since several new features are waiting for this one and it's easier to rebase those branches when this branch is not squashed. |
0xdaryl
left a comment
There was a problem hiding this comment.
Thanks for fixing the sprintfs.
- Implement a class that can monitor RSS status of any number of arbitry memory regions - In addition to start address and size, region can have name, as well as a list of items describing its content
|
Squashed all the commits. |
|
jenkins build all |
| ${CMAKE_CURRENT_LIST_DIR}/OMRCodeCacheManager.cpp | ||
| ${CMAKE_CURRENT_LIST_DIR}/OMRCodeCacheMemorySegment.cpp | ||
| ${CMAKE_CURRENT_LIST_DIR}/OMRCodeCacheConfig.cpp | ||
| ${CMAKE_CURRENT_LIST_DIR}/OMRRSSReport.cpp |
There was a problem hiding this comment.
Shouldn't an equivalent change be made in makefiles like jitbuilder/build/files/common.mk for example?
There was a problem hiding this comment.
I suspect this is the reason internal builds are failing (e.g. z/OS):
IEW2456E 9207 SYMBOL addRSSItem__Q2_3OMR9RSSRegionFPQ2_3OMR7RSSItemiPCc
UNRESOLVED. MEMBER COULD NOT BE INCLUDED FROM THE DESIGNATED CALL
LIBRARY.
IEW2456E 9207 SYMBOL _instance__Q2_3OMR9RSSReport UNRESOLVED. MEMBER COULD NOT
BE INCLUDED FROM THE DESIGNATED CALL LIBRARY. NAME SPACE = 3
FSUM3065 The LINKEDIT step ended with return code 8.
/j9tmp/bld_74387/bld_zos_390/compiler/../compiler/build/rules/zos-xlc/common.mk:47: recipe for target '/j9tmp/bld_74387/bld_zos_390/compiler/../libj9jit29.so' failed
eclipse-omr/omr#7349 added a new file called OMRRSSRegion.cpp. Although this file was added to the CMakeLists.txt for OMR, there does not exist a common UMA config to add this file. As such, the OpenJ9 build when using UMA is broken. This commit fixes this by adding this file to the UMA config. Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>