changeset 48822:8a9808a9dd6b

8196487: AIX: os::get_summary_cpu_info does not need to call into libperfstat Reviewed-by: goetz, stuefe
author clanger
date Wed, 31 Jan 2018 16:48:41 +0100
parents 8250a10cf60f
children 99c973b56994
files src/hotspot/os/aix/libperfstat_aix.cpp src/hotspot/os/aix/libperfstat_aix.hpp src/hotspot/os/aix/os_aix.cpp
diffstat 3 files changed, 69 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/os/aix/libperfstat_aix.cpp	Wed Jan 31 15:10:04 2018 +0100
+++ b/src/hotspot/os/aix/libperfstat_aix.cpp	Wed Jan 31 16:48:41 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016 SAP SE. All rights reserved.
+ * Copyright (c) 2012, 2018 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
 #include "misc_aix.hpp"
 
 #include <dlfcn.h>
-#include <sys/systemcfg.h>
 
 // Handle to the libperfstat.
 static void* g_libhandle = NULL;
@@ -158,17 +157,6 @@
 
 //////////////////// convenience functions, release-independent /////////////////////////////
 
-// Excerpts from systemcfg.h definitions newer than AIX 5.3 (our oldest build platform)
-
-#define PV_6 0x100000          /* Power PC 6 */
-#define PV_6_1 0x100001        /* Power PC 6 DD1.x */
-#define PV_7 0x200000          /* Power PC 7 */
-#define PV_5_Compat 0x0F8000   /* Power PC 5 */
-#define PV_6_Compat 0x108000   /* Power PC 6 */
-#define PV_7_Compat 0x208000   /* Power PC 7 */
-#define PV_8 0x300000          /* Power PC 8 */
-#define PV_8_Compat 0x308000   /* Power PC 8 */
-
 
 // Retrieve global cpu information.
 bool libperfstat::get_cpuinfo(cpuinfo_t* pci) {
@@ -191,7 +179,7 @@
   }
 
   // Global cpu information.
-  strcpy (pci->description, psct.description);
+  strcpy(pci->description, psct.description);
   pci->processorHZ = psct.processorHZ;
   pci->ncpus = psct.ncpus;
   for (int i = 0; i < 3; i++) {
@@ -203,45 +191,6 @@
   pci->idle_clock_ticks = psct.idle;
   pci->wait_clock_ticks = psct.wait;
 
-  // Get the processor version from _system_configuration.
-  switch (_system_configuration.version) {
-  case PV_8:
-    strcpy(pci->version, "Power PC 8");
-    break;
-  case PV_7:
-    strcpy(pci->version, "Power PC 7");
-    break;
-  case PV_6_1:
-    strcpy(pci->version, "Power PC 6 DD1.x");
-    break;
-  case PV_6:
-    strcpy(pci->version, "Power PC 6");
-    break;
-  case PV_5:
-    strcpy(pci->version, "Power PC 5");
-    break;
-  case PV_5_2:
-    strcpy(pci->version, "Power PC 5_2");
-    break;
-  case PV_5_3:
-    strcpy(pci->version, "Power PC 5_3");
-    break;
-  case PV_5_Compat:
-    strcpy(pci->version, "PV_5_Compat");
-    break;
-  case PV_6_Compat:
-    strcpy(pci->version, "PV_6_Compat");
-    break;
-  case PV_7_Compat:
-    strcpy(pci->version, "PV_7_Compat");
-    break;
-  case PV_8_Compat:
-    strcpy(pci->version, "PV_8_Compat");
-    break;
-  default:
-    strcpy(pci->version, "unknown");
-  }
-
   return true;
 }
 
--- a/src/hotspot/os/aix/libperfstat_aix.hpp	Wed Jan 31 15:10:04 2018 +0100
+++ b/src/hotspot/os/aix/libperfstat_aix.hpp	Wed Jan 31 16:48:41 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016 SAP SE. All rights reserved.
+ * Copyright (c) 2012, 2018 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -942,7 +942,6 @@
     int ncpus;                            // number of active logical processors
     double loadavg[3];                    // (1<<SBITS) times the average number of runnables processes during the last 1, 5 and 15 minutes.
                                           // To calculate the load average, divide the numbers by (1<<SBITS). SBITS is defined in <sys/proc.h>.
-    char version[20];                     // processor version from _system_configuration (sys/systemcfg.h)
     unsigned long long user_clock_ticks;  // raw total number of clock ticks spent in user mode
     unsigned long long sys_clock_ticks;   // raw total number of clock ticks spent in system mode
     unsigned long long idle_clock_ticks;  // raw total number of clock ticks spent idle
@@ -965,7 +964,6 @@
   static bool get_partitioninfo(partitioninfo_t* ppi);
   static bool get_cpuinfo(cpuinfo_t* pci);
   static bool get_wparinfo(wparinfo_t* pwi);
-
 };
 
 #endif // OS_AIX_VM_LIBPERFSTAT_AIX_HPP
--- a/src/hotspot/os/aix/os_aix.cpp	Wed Jan 31 15:10:04 2018 +0100
+++ b/src/hotspot/os/aix/os_aix.cpp	Wed Jan 31 16:48:41 2018 +0100
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2017 SAP SE. All rights reserved.
+ * Copyright (c) 2012, 2018 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -117,7 +117,7 @@
 #if !defined(_AIXVERSION_610)
 extern "C" int getthrds64(pid_t, struct thrdentry64*, int, tid64_t*, int);
 extern "C" int getprocs64(procentry64*, int, fdsinfo*, int, pid_t*, int);
-extern "C" int getargs   (procsinfo*, int, char*, int);
+extern "C" int getargs(procsinfo*, int, char*, int);
 #endif
 
 #define MAX_PATH (2 * K)
@@ -130,6 +130,32 @@
 #define ERROR_MP_VMGETINFO_FAILED                    102
 #define ERROR_MP_VMGETINFO_CLAIMS_NO_SUPPORT_FOR_64K 103
 
+// excerpts from systemcfg.h that might be missing on older os levels
+#ifndef PV_5_Compat
+  #define PV_5_Compat 0x0F8000   /* Power PC 5 */
+#endif
+#ifndef PV_6
+  #define PV_6 0x100000          /* Power PC 6 */
+#endif
+#ifndef PV_6_1
+  #define PV_6_1 0x100001        /* Power PC 6 DD1.x */
+#endif
+#ifndef PV_6_Compat
+  #define PV_6_Compat 0x108000   /* Power PC 6 */
+#endif
+#ifndef PV_7
+  #define PV_7 0x200000          /* Power PC 7 */
+#endif
+#ifndef PV_7_Compat
+  #define PV_7_Compat 0x208000   /* Power PC 7 */
+#endif
+#ifndef PV_8
+  #define PV_8 0x300000          /* Power PC 8 */
+#endif
+#ifndef PV_8_Compat
+  #define PV_8_Compat 0x308000   /* Power PC 8 */
+#endif
+
 static address resolve_function_descriptor_to_code_pointer(address p);
 
 static void vmembk_print_on(outputStream* os);
@@ -1445,17 +1471,48 @@
 
 // Get a string for the cpuinfo that is a summary of the cpu type
 void os::get_summary_cpu_info(char* buf, size_t buflen) {
-  // This looks good
-  libperfstat::cpuinfo_t ci;
-  if (libperfstat::get_cpuinfo(&ci)) {
-    strncpy(buf, ci.version, buflen);
-  } else {
-    strncpy(buf, "AIX", buflen);
+  // read _system_configuration.version
+  switch (_system_configuration.version) {
+  case PV_8:
+    strncpy(buf, "Power PC 8", buflen);
+    break;
+  case PV_7:
+    strncpy(buf, "Power PC 7", buflen);
+    break;
+  case PV_6_1:
+    strncpy(buf, "Power PC 6 DD1.x", buflen);
+    break;
+  case PV_6:
+    strncpy(buf, "Power PC 6", buflen);
+    break;
+  case PV_5:
+    strncpy(buf, "Power PC 5", buflen);
+    break;
+  case PV_5_2:
+    strncpy(buf, "Power PC 5_2", buflen);
+    break;
+  case PV_5_3:
+    strncpy(buf, "Power PC 5_3", buflen);
+    break;
+  case PV_5_Compat:
+    strncpy(buf, "PV_5_Compat", buflen);
+    break;
+  case PV_6_Compat:
+    strncpy(buf, "PV_6_Compat", buflen);
+    break;
+  case PV_7_Compat:
+    strncpy(buf, "PV_7_Compat", buflen);
+    break;
+  case PV_8_Compat:
+    strncpy(buf, "PV_8_Compat", buflen);
+    break;
+  default:
+    strncpy(buf, "unknown", buflen);
   }
 }
 
 void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
-  // Nothing to do beyond what os::print_cpu_info() does.
+  // Nothing to do beyond of what os::print_cpu_info() does.
 }
 
 static void print_signal_handler(outputStream* st, int sig,