8206408: Add missing CPU/system info to vm_version_ext on PPC64

Reviewed-by: mdoerr, simonis
This commit is contained in:
Gunter Haug 2018-07-09 12:51:58 +02:00
parent 51422fc2a9
commit f36f4df68d
2 changed files with 18 additions and 10 deletions

View File

@ -25,19 +25,30 @@
#include "jvm.h"
#include "memory/allocation.hpp"
#include "memory/allocation.inline.hpp"
#include "runtime/vm_version.hpp"
#include "vm_version_ext_ppc.hpp"
// VM_Version_Ext statics
int VM_Version_Ext::_no_of_threads = 0;
int VM_Version_Ext::_no_of_cores = 0;
int VM_Version_Ext::_no_of_sockets = 0;
bool VM_Version_Ext::_initialized = false;
char VM_Version_Ext::_cpu_name[CPU_TYPE_DESC_BUF_SIZE] = {0};
char VM_Version_Ext::_cpu_desc[CPU_DETAILED_DESC_BUF_SIZE] = {0};
// get cpu information.
bool VM_Version_Ext::initialize_cpu_information(void) {
// Not yet implemented.
return false;
void VM_Version_Ext::initialize_cpu_information(void) {
// do nothing if cpu info has been initialized
if (_initialized) {
return;
}
_no_of_cores = os::processor_count();
_no_of_threads = _no_of_cores;
_no_of_sockets = _no_of_cores;
snprintf(_cpu_name, CPU_TYPE_DESC_BUF_SIZE, "PowerPC POWER%lu", PowerArchitecturePPC64);
snprintf(_cpu_desc, CPU_DETAILED_DESC_BUF_SIZE, "PPC %s", features_string());
_initialized = true;
}
int VM_Version_Ext::number_of_threads(void) {
@ -56,9 +67,7 @@ int VM_Version_Ext::number_of_sockets(void) {
}
const char* VM_Version_Ext::cpu_name(void) {
if (!initialize_cpu_information()) {
return NULL;
}
initialize_cpu_information();
char* tmp = NEW_C_HEAP_ARRAY_RETURN_NULL(char, CPU_TYPE_DESC_BUF_SIZE, mtTracing);
if (NULL == tmp) {
return NULL;
@ -68,9 +77,7 @@ const char* VM_Version_Ext::cpu_name(void) {
}
const char* VM_Version_Ext::cpu_description(void) {
if (!initialize_cpu_information()) {
return NULL;
}
initialize_cpu_information();
char* tmp = NEW_C_HEAP_ARRAY_RETURN_NULL(char, CPU_DETAILED_DESC_BUF_SIZE, mtTracing);
if (NULL == tmp) {
return NULL;

View File

@ -43,10 +43,11 @@ class VM_Version_Ext : public VM_Version {
static int _no_of_threads;
static int _no_of_cores;
static int _no_of_sockets;
static bool _initialized;
static char _cpu_name[CPU_TYPE_DESC_BUF_SIZE];
static char _cpu_desc[CPU_DETAILED_DESC_BUF_SIZE];
static bool initialize_cpu_information(void);
static void initialize_cpu_information(void);
public: