RFR: JDK-8284758: [linux] improve print_container_info [v2]

Severin Gehwolf sgehwolf at openjdk.java.net
Wed Apr 13 16:11:16 UTC 2022


On Wed, 13 Apr 2022 14:17:52 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> Currently on Linux, os::Linux::print_container_info might print rather badly unreadable memory infos like :
>> 
>> memory_usage_in_bytes: 18029760512
>> memory_max_usage_in_bytes: 423686144
>> 
>> This could be improved , at a lot of places in the hs_err file output we already print the larger memory-related infos in k , for example rlimit information
>> or /proc/meminfo.
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   adjust print_container_helper

src/hotspot/os/linux/os_linux.cpp line 2191:

> 2189:   st->print("%s: ", metrics);
> 2190:   if (j > 0) {
> 2191:     st->print_cr(UINT64_FORMAT " k", uint64_t(j) / 1024);

Shouldn't this check whether or not `j >= 1024` before doing the division? I'm thinking:

if (j > 0) {
    if (j >= 1024) {
       st->print_cr(UINT64_FORMAT " k", uint64_t(j) / 1024);
   } else {
      st->print_cr(UINT64_FORMAT, uint64_t(j));
   }

-------------

PR: https://git.openjdk.java.net/jdk/pull/8217


More information about the hotspot-runtime-dev mailing list