8231753: use more Posix functionality in aix os::print_os_info
authormbaesken
Tue, 08 Oct 2019 09:33:57 +0200
changeset 58492 227ddf1ff93d
parent 58491 452ad8f882c6
child 58493 55a8d95c7787
8231753: use more Posix functionality in aix os::print_os_info Reviewed-by: clanger, dholmes
src/hotspot/os/aix/os_aix.cpp
src/hotspot/os/posix/os_posix.cpp
--- a/src/hotspot/os/aix/os_aix.cpp	Wed Oct 02 10:01:18 2019 +0200
+++ b/src/hotspot/os/aix/os_aix.cpp	Tue Oct 08 09:33:57 2019 +0200
@@ -1381,15 +1381,7 @@
 void os::print_os_info(outputStream* st) {
   st->print("OS:");
 
-  st->print("uname:");
-  struct utsname name;
-  uname(&name);
-  st->print(name.sysname); st->print(" ");
-  st->print(name.nodename); st->print(" ");
-  st->print(name.release); st->print(" ");
-  st->print(name.version); st->print(" ");
-  st->print(name.machine);
-  st->cr();
+  os::Posix::print_uname_info(st);
 
   uint32_t ver = os::Aix::os_version();
   st->print_cr("AIX kernel version %u.%u.%u.%u",
@@ -1397,16 +1389,12 @@
 
   os::Posix::print_rlimit_info(st);
 
+  os::Posix::print_load_average(st);
+
   // _SC_THREAD_THREADS_MAX is the maximum number of threads within a process.
   long tmax = sysconf(_SC_THREAD_THREADS_MAX);
   st->print_cr("maximum #threads within a process:%ld", tmax);
 
-  // load average
-  st->print("load average:");
-  double loadavg[3] = {-1.L, -1.L, -1.L};
-  os::loadavg(loadavg, 3);
-  st->print_cr("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
-
   // print wpar info
   libperfstat::wparinfo_t wi;
   if (libperfstat::get_wparinfo(&wi)) {
--- a/src/hotspot/os/posix/os_posix.cpp	Wed Oct 02 10:01:18 2019 +0200
+++ b/src/hotspot/os/posix/os_posix.cpp	Tue Oct 08 09:33:57 2019 +0200
@@ -373,8 +373,12 @@
 void os::Posix::print_load_average(outputStream* st) {
   st->print("load average:");
   double loadavg[3];
-  os::loadavg(loadavg, 3);
-  st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
+  int res = os::loadavg(loadavg, 3);
+  if (res != -1) {
+    st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
+  } else {
+    st->print(" Unavailable");
+  }
   st->cr();
 }