8234397: add OS uptime information to os::print_os_info output
David Holmes
david.holmes at oracle.com
Mon Dec 2 01:01:27 UTC 2019
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
> Best regards, Matthias
>
>
>> -----Original Message-----
>> From: Langer, Christoph <christoph.langer at sap.com>
>> Sent: Donnerstag, 28. November 2019 11:55
>> To: Baesken, Matthias <matthias.baesken at sap.com>; Schmidt, Lutz
>> <lutz.schmidt at sap.com>; David Holmes <david.holmes at oracle.com>;
>> 'hotspot-dev at openjdk.java.net' <hotspot-dev at openjdk.java.net>
>> Subject: RE: 8234397: add OS uptime information to os::print_os_info output
>>
>> Hi Matthias,
>>
>> I'd like to see the uptime information in hs_err files.
>>
>> I, however, would rather like to see a more readable output like "OS uptime
>> 10 days 3:10". I understand that's some more formatting effort but on the
>> other hand you'd not need floating point calculations.
>>
>> As for os_windows.cpp: Why don't you spend a
>> os::win32::print_uptime_info(st); method to align with the other
>> implementations?
>>
>> Best regards
>> Christoph
>
More information about the hotspot-dev
mailing list