author | zgu |
Thu, 07 Nov 2019 09:41:22 -0500 | |
changeset 58964 | 029d941c2e35 |
parent 53139 | a3e7e08ee427 |
permissions | -rw-r--r-- |
50113 | 1 |
/* |
2 |
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
25 |
#include "memory/allocation.hpp" |
|
26 |
#include "memory/allocation.inline.hpp" |
|
27 |
#include "runtime/os.inline.hpp" |
|
28 |
#include "vm_version_ext_aarch64.hpp" |
|
29 |
||
30 |
// VM_Version_Ext statics |
|
31 |
int VM_Version_Ext::_no_of_threads = 0; |
|
32 |
int VM_Version_Ext::_no_of_cores = 0; |
|
33 |
int VM_Version_Ext::_no_of_sockets = 0; |
|
34 |
bool VM_Version_Ext::_initialized = false; |
|
35 |
char VM_Version_Ext::_cpu_name[CPU_TYPE_DESC_BUF_SIZE] = {0}; |
|
36 |
char VM_Version_Ext::_cpu_desc[CPU_DETAILED_DESC_BUF_SIZE] = {0}; |
|
37 |
||
38 |
void VM_Version_Ext::initialize_cpu_information(void) { |
|
39 |
// do nothing if cpu info has been initialized |
|
40 |
if (_initialized) { |
|
41 |
return; |
|
42 |
} |
|
43 |
||
44 |
int core_id = -1; |
|
45 |
int chip_id = -1; |
|
46 |
int len = 0; |
|
47 |
char* src_string = NULL; |
|
48 |
||
49 |
_no_of_cores = os::processor_count(); |
|
50 |
_no_of_threads = _no_of_cores; |
|
51 |
_no_of_sockets = _no_of_cores; |
|
52 |
snprintf(_cpu_name, CPU_TYPE_DESC_BUF_SIZE - 1, "AArch64"); |
|
53139
a3e7e08ee427
8215961: jdk/jfr/event/os/TestCPUInformation.java fails on AArch64
mbaesken
parents:
50113
diff
changeset
|
53 |
snprintf(_cpu_desc, CPU_DETAILED_DESC_BUF_SIZE, "AArch64 %s", _features_string); |
50113 | 54 |
_initialized = true; |
55 |
} |
|
56 |
||
57 |
int VM_Version_Ext::number_of_threads(void) { |
|
58 |
initialize_cpu_information(); |
|
59 |
return _no_of_threads; |
|
60 |
} |
|
61 |
||
62 |
int VM_Version_Ext::number_of_cores(void) { |
|
63 |
initialize_cpu_information(); |
|
64 |
return _no_of_cores; |
|
65 |
} |
|
66 |
||
67 |
int VM_Version_Ext::number_of_sockets(void) { |
|
68 |
initialize_cpu_information(); |
|
69 |
return _no_of_sockets; |
|
70 |
} |
|
71 |
||
72 |
const char* VM_Version_Ext::cpu_name(void) { |
|
73 |
initialize_cpu_information(); |
|
74 |
char* tmp = NEW_C_HEAP_ARRAY_RETURN_NULL(char, CPU_TYPE_DESC_BUF_SIZE, mtTracing); |
|
75 |
if (NULL == tmp) { |
|
76 |
return NULL; |
|
77 |
} |
|
78 |
strncpy(tmp, _cpu_name, CPU_TYPE_DESC_BUF_SIZE); |
|
79 |
return tmp; |
|
80 |
} |
|
81 |
||
82 |
const char* VM_Version_Ext::cpu_description(void) { |
|
83 |
initialize_cpu_information(); |
|
84 |
char* tmp = NEW_C_HEAP_ARRAY_RETURN_NULL(char, CPU_DETAILED_DESC_BUF_SIZE, mtTracing); |
|
85 |
if (NULL == tmp) { |
|
86 |
return NULL; |
|
87 |
} |
|
88 |
strncpy(tmp, _cpu_desc, CPU_DETAILED_DESC_BUF_SIZE); |
|
89 |
return tmp; |
|
90 |
} |