8234397: add OS uptime information to os::print_os_info output

Baesken, Matthias matthias.baesken at sap.com
Tue Dec 3 15:38:04 UTC 2019


Hi David,  here is a new webrev   based on  your comments :

http://cr.openjdk.java.net/~mbaesken/webrevs/8234397.4/

> 
> Is %llu supported by all compilers (32-bit as well)?
>

Not sure , I checked and  it works  with VS2017/32bit.  But I don't know about other compilers.    So I better use long / %ld.


Btw I noticed that 

os::print_date_and_time
 ...
 // print elapsed time in a human-readable format:

Contains  very similar coding  to  what I do in os::print_dhm  -->  should this maybe be unified ?


Best regards, Matthias



> Hi Matthias,
> 
> On 29/11/2019 11:58 pm, Baesken, Matthias wrote:
> > Hi, here is a new webrev,  this time with nicer  output  (see os.cpp) .
> >
> > http://cr.openjdk.java.net/~mbaesken/webrevs/8234397.3/
> 
> src/hotspot/os/bsd/os_bsd.cpp
> 
> This link may be more general than the Apple "iOS" one.
> 
> https://man.openbsd.org/sysctl.2
> 
> +    time_t bootsec = boottime.tv_sec, currsec = time(NULL);
> 
> Please write the two declarations on separate lines.
> 
> ---
> 
> src/hotspot/os/posix/os_posix.cpp
> 
> + // unfortunately it does not work on macOS
> 
> Still no mention of Linux
> 
> ---
> 
> src/hotspot/share/runtime/os.cpp
> 
> +   if (minutes < 10) {
> +     st->print_cr("%s %llu days %llu:0%llu hours", startStr, days,
> hours, minutes);
> +   } else {
> +     st->print_cr("%s %llu days %llu:%llu hours", startStr, days,
> hours, minutes);
> +   }
> 
> You should just use a zero-padded width of 2 to get 01..09 for minutes.
> 
> Is %llu supported by all compilers (32-bit as well)?
> 
> ---
> 
> src/hotspot/os/windows/os_windows.cpp
> 
> +  unsigned long long ticks = GetTickCount64();
> +  os::print_dhm(st, "OS uptime:", ticks);
> 
> GetTickCount64 returns milliseconds since boot not seconds.
> 
> ---
> 
> Thanks,
> David
> 



More information about the hotspot-dev mailing list