author | mgronlun |
Wed, 30 Oct 2019 19:43:52 +0100 | |
changeset 58863 | c16ac7a2eba4 |
parent 55078 | e63a624da347 |
permissions | -rw-r--r-- |
50113 | 1 |
/* |
53367
c3fa35381763
8216578: Remove unused/obsolete method in JFR code
stooke
parents:
50879
diff
changeset
|
2 |
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. |
50113 | 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 "precompiled.hpp" |
|
26 |
#include "jfr/jfrEvents.hpp" |
|
50879 | 27 |
#include "jfr/periodic/jfrNetworkUtilization.hpp" |
50113 | 28 |
#include "jfr/periodic/jfrOSInterface.hpp" |
29 |
#include "memory/allocation.inline.hpp" |
|
30 |
#include "memory/resourceArea.hpp" |
|
31 |
#include "runtime/os.hpp" |
|
32 |
#include "runtime/os_perf.hpp" |
|
33 |
#include "utilities/ostream.hpp" |
|
34 |
||
35 |
#include <stdlib.h> // for environment variables |
|
36 |
#ifdef __APPLE__ |
|
37 |
#include <crt_externs.h> |
|
38 |
#define environ (*_NSGetEnviron()) |
|
39 |
#endif |
|
40 |
||
41 |
#ifndef environ |
|
42 |
extern char** environ; |
|
43 |
#endif |
|
44 |
||
45 |
static JfrOSInterface* _instance = NULL; |
|
46 |
||
47 |
JfrOSInterface& JfrOSInterface::instance() { |
|
48 |
return *_instance; |
|
49 |
} |
|
50 |
||
51 |
JfrOSInterface* JfrOSInterface::create() { |
|
52 |
assert(_instance == NULL, "invariant"); |
|
53 |
_instance = new JfrOSInterface(); |
|
54 |
return _instance; |
|
55 |
} |
|
56 |
||
57 |
void JfrOSInterface::destroy() { |
|
50879 | 58 |
JfrNetworkUtilization::destroy(); |
50113 | 59 |
if (_instance != NULL) { |
60 |
delete _instance; |
|
61 |
_instance = NULL; |
|
62 |
} |
|
63 |
} |
|
64 |
||
65 |
class JfrOSInterface::JfrOSInterfaceImpl : public JfrCHeapObj { |
|
66 |
friend class JfrOSInterface; |
|
67 |
private: |
|
68 |
CPUInformationInterface* _cpu_info_interface; |
|
69 |
CPUPerformanceInterface* _cpu_perf_interface; |
|
55078
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
70 |
SystemProcessInterface* _system_process_interface; |
50879 | 71 |
NetworkPerformanceInterface* _network_performance_interface; |
50113 | 72 |
|
55078
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
73 |
CPUInformationInterface* cpu_info_interface(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
74 |
CPUPerformanceInterface* cpu_perf_interface(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
75 |
SystemProcessInterface* system_process_interface(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
76 |
NetworkPerformanceInterface* network_performance_interface(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
77 |
|
50113 | 78 |
JfrOSInterfaceImpl(); |
79 |
bool initialize(); |
|
80 |
~JfrOSInterfaceImpl(); |
|
81 |
||
82 |
// cpu info |
|
83 |
int cpu_information(CPUInformation& cpu_info); |
|
84 |
int cpu_load(int which_logical_cpu, double* cpu_load); |
|
85 |
int context_switch_rate(double* rate); |
|
86 |
int cpu_load_total_process(double* cpu_load); |
|
87 |
int cpu_loads_process(double* pjvmUserLoad, double* pjvmKernelLoad, double* psystemTotal); |
|
88 |
||
89 |
// os information |
|
90 |
int os_version(char** os_version) const; |
|
91 |
||
92 |
// environment information |
|
93 |
void generate_environment_variables_events(); |
|
94 |
||
95 |
// system processes information |
|
96 |
int system_processes(SystemProcess** system_processes, int* no_of_sys_processes); |
|
50879 | 97 |
|
55078
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
98 |
int network_utilization(NetworkInterface** network_interfaces); |
50113 | 99 |
}; |
100 |
||
101 |
JfrOSInterface::JfrOSInterfaceImpl::JfrOSInterfaceImpl() : _cpu_info_interface(NULL), |
|
102 |
_cpu_perf_interface(NULL), |
|
55078
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
103 |
_system_process_interface(NULL), |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
104 |
_network_performance_interface(NULL) {} |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
105 |
|
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
106 |
template <typename T> |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
107 |
static T* create_interface() { |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
108 |
ResourceMark rm; |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
109 |
T* iface = new T(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
110 |
if (iface != NULL) { |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
111 |
if (!iface->initialize()) { |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
112 |
delete iface; |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
113 |
iface = NULL; |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
114 |
} |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
115 |
} |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
116 |
return iface; |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
117 |
} |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
118 |
|
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
119 |
CPUInformationInterface* JfrOSInterface::JfrOSInterfaceImpl::cpu_info_interface() { |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
120 |
if (_cpu_info_interface == NULL) { |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
121 |
_cpu_info_interface = create_interface<CPUInformationInterface>(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
122 |
} |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
123 |
return _cpu_info_interface; |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
124 |
} |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
125 |
|
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
126 |
CPUPerformanceInterface* JfrOSInterface::JfrOSInterfaceImpl::cpu_perf_interface() { |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
127 |
if (_cpu_perf_interface == NULL) { |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
128 |
_cpu_perf_interface = create_interface<CPUPerformanceInterface>(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
129 |
} |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
130 |
return _cpu_perf_interface; |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
131 |
} |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
132 |
|
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
133 |
SystemProcessInterface* JfrOSInterface::JfrOSInterfaceImpl::system_process_interface() { |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
134 |
if (_system_process_interface == NULL) { |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
135 |
_system_process_interface = create_interface<SystemProcessInterface>(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
136 |
} |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
137 |
return _system_process_interface; |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
138 |
} |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
139 |
|
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
140 |
NetworkPerformanceInterface* JfrOSInterface::JfrOSInterfaceImpl::network_performance_interface() { |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
141 |
if (_network_performance_interface == NULL) { |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
142 |
_network_performance_interface = create_interface<NetworkPerformanceInterface>(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
143 |
} |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
144 |
return _network_performance_interface; |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
145 |
} |
50113 | 146 |
|
147 |
bool JfrOSInterface::JfrOSInterfaceImpl::initialize() { |
|
55078
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
148 |
return true; |
50113 | 149 |
} |
150 |
||
151 |
JfrOSInterface::JfrOSInterfaceImpl::~JfrOSInterfaceImpl(void) { |
|
152 |
if (_cpu_info_interface != NULL) { |
|
153 |
delete _cpu_info_interface; |
|
154 |
_cpu_info_interface = NULL; |
|
155 |
} |
|
156 |
if (_cpu_perf_interface != NULL) { |
|
157 |
delete _cpu_perf_interface; |
|
158 |
_cpu_perf_interface = NULL; |
|
159 |
} |
|
160 |
if (_system_process_interface != NULL) { |
|
161 |
delete _system_process_interface; |
|
162 |
_system_process_interface = NULL; |
|
163 |
} |
|
50879 | 164 |
if (_network_performance_interface != NULL) { |
165 |
delete _network_performance_interface; |
|
166 |
_network_performance_interface = NULL; |
|
167 |
} |
|
50113 | 168 |
} |
169 |
||
55078
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
170 |
int JfrOSInterface::JfrOSInterfaceImpl::cpu_information(CPUInformation& cpu_info) { |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
171 |
CPUInformationInterface* const iface = cpu_info_interface(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
172 |
return iface == NULL ? OS_ERR : iface->cpu_information(cpu_info); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
173 |
} |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
174 |
|
50113 | 175 |
int JfrOSInterface::JfrOSInterfaceImpl::cpu_load(int which_logical_cpu, double* cpu_load) { |
55078
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
176 |
CPUPerformanceInterface* const iface = cpu_perf_interface(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
177 |
return iface == NULL ? OS_ERR : iface->cpu_load(which_logical_cpu, cpu_load); |
50113 | 178 |
} |
179 |
||
180 |
int JfrOSInterface::JfrOSInterfaceImpl::context_switch_rate(double* rate) { |
|
55078
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
181 |
CPUPerformanceInterface* const iface = cpu_perf_interface(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
182 |
return iface == NULL ? OS_ERR : iface->context_switch_rate(rate); |
50113 | 183 |
} |
184 |
||
185 |
int JfrOSInterface::JfrOSInterfaceImpl::cpu_load_total_process(double* cpu_load) { |
|
55078
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
186 |
CPUPerformanceInterface* const iface = cpu_perf_interface(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
187 |
return iface == NULL ? OS_ERR : iface->cpu_load_total_process(cpu_load); |
50113 | 188 |
} |
189 |
||
190 |
int JfrOSInterface::JfrOSInterfaceImpl::cpu_loads_process(double* pjvmUserLoad, |
|
191 |
double* pjvmKernelLoad, |
|
192 |
double* psystemTotal) { |
|
55078
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
193 |
CPUPerformanceInterface* const iface = cpu_perf_interface(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
194 |
return iface == NULL ? OS_ERR : iface->cpu_loads_process(pjvmUserLoad, pjvmKernelLoad, psystemTotal); |
50113 | 195 |
} |
196 |
||
197 |
int JfrOSInterface::JfrOSInterfaceImpl::system_processes(SystemProcess** system_processes, int* no_of_sys_processes) { |
|
198 |
assert(system_processes != NULL, "system_processes pointer is NULL!"); |
|
199 |
assert(no_of_sys_processes != NULL, "no_of_sys_processes pointer is NULL!"); |
|
55078
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
200 |
SystemProcessInterface* const iface = system_process_interface(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
201 |
return iface == NULL ? OS_ERR : iface->system_processes(system_processes, no_of_sys_processes); |
50113 | 202 |
} |
203 |
||
55078
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
204 |
int JfrOSInterface::JfrOSInterfaceImpl::network_utilization(NetworkInterface** network_interfaces) { |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
205 |
NetworkPerformanceInterface* const iface = network_performance_interface(); |
e63a624da347
8217089: JFR: Lazy install os interface components for improved startup
mgronlun
parents:
54899
diff
changeset
|
206 |
return iface == NULL ? OS_ERR : iface->network_utilization(network_interfaces); |
50879 | 207 |
} |
208 |
||
50113 | 209 |
// assigned char* is RESOURCE_HEAP_ALLOCATED |
210 |
// caller need to ensure proper ResourceMark placement. |
|
211 |
int JfrOSInterface::JfrOSInterfaceImpl::os_version(char** os_version) const { |
|
212 |
assert(os_version != NULL, "os_version pointer is NULL!"); |
|
213 |
stringStream os_ver_info; |
|
214 |
os::print_os_info_brief(&os_ver_info); |
|
215 |
*os_version = os_ver_info.as_string(); |
|
216 |
return OS_OK; |
|
217 |
} |
|
218 |
||
219 |
JfrOSInterface::JfrOSInterface() { |
|
220 |
_impl = NULL; |
|
221 |
} |
|
222 |
||
223 |
bool JfrOSInterface::initialize() { |
|
224 |
_impl = new JfrOSInterface::JfrOSInterfaceImpl(); |
|
225 |
return _impl != NULL && _impl->initialize(); |
|
226 |
} |
|
227 |
||
228 |
JfrOSInterface::~JfrOSInterface() { |
|
229 |
if (_impl != NULL) { |
|
230 |
delete _impl; |
|
231 |
_impl = NULL; |
|
232 |
} |
|
233 |
} |
|
234 |
||
235 |
int JfrOSInterface::cpu_information(CPUInformation& cpu_info) { |
|
236 |
return instance()._impl->cpu_information(cpu_info); |
|
237 |
} |
|
238 |
||
239 |
int JfrOSInterface::cpu_load(int which_logical_cpu, double* cpu_load) { |
|
240 |
return instance()._impl->cpu_load(which_logical_cpu, cpu_load); |
|
241 |
} |
|
242 |
||
243 |
int JfrOSInterface::context_switch_rate(double* rate) { |
|
244 |
return instance()._impl->context_switch_rate(rate); |
|
245 |
} |
|
246 |
||
247 |
int JfrOSInterface::cpu_load_total_process(double* cpu_load) { |
|
248 |
return instance()._impl->cpu_load_total_process(cpu_load); |
|
249 |
} |
|
250 |
||
251 |
int JfrOSInterface::cpu_loads_process(double* jvm_user_load, double* jvm_kernel_load, double* system_total_load){ |
|
252 |
return instance()._impl->cpu_loads_process(jvm_user_load, jvm_kernel_load, system_total_load); |
|
253 |
} |
|
254 |
||
255 |
int JfrOSInterface::os_version(char** os_version) { |
|
256 |
return instance()._impl->os_version(os_version); |
|
257 |
} |
|
258 |
||
54899
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
259 |
const char* JfrOSInterface::virtualization_name() { |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
260 |
VirtualizationType vrt = VM_Version::get_detected_virtualization(); |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
261 |
if (vrt == XenHVM) { |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
262 |
return "Xen hardware-assisted virtualization"; |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
263 |
} else if (vrt == KVM) { |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
264 |
return "KVM virtualization"; |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
265 |
} else if (vrt == VMWare) { |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
266 |
return "VMWare virtualization"; |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
267 |
} else if (vrt == HyperV) { |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
268 |
return "HyperV virtualization"; |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
269 |
} else if (vrt == PowerVM) { |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
270 |
return "PowerVM virtualization"; |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
271 |
} else if (vrt == PowerKVM) { |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
272 |
return "Power KVM virtualization"; |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
273 |
} else if (vrt == PowerFullPartitionMode) { |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
274 |
return "Power full partition"; |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
275 |
} |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
276 |
|
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
277 |
return "No virtualization detected"; |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
278 |
} |
e4cff3cf0234
8223438: add VirtualizationInformation JFR event
mbaesken
parents:
53367
diff
changeset
|
279 |
|
50113 | 280 |
int JfrOSInterface::generate_initial_environment_variable_events() { |
281 |
if (environ == NULL) { |
|
282 |
return OS_ERR; |
|
283 |
} |
|
284 |
||
285 |
if (EventInitialEnvironmentVariable::is_enabled()) { |
|
286 |
// One time stamp for all events, so they can be grouped together |
|
287 |
JfrTicks time_stamp = JfrTicks::now(); |
|
288 |
for (char** p = environ; *p != NULL; p++) { |
|
289 |
char* variable = *p; |
|
290 |
char* equal_sign = strchr(variable, '='); |
|
291 |
if (equal_sign != NULL) { |
|
292 |
// Extract key/value |
|
293 |
ResourceMark rm; |
|
294 |
ptrdiff_t key_length = equal_sign - variable; |
|
295 |
char* key = NEW_RESOURCE_ARRAY(char, key_length + 1); |
|
296 |
char* value = equal_sign + 1; |
|
297 |
strncpy(key, variable, key_length); |
|
298 |
key[key_length] = '\0'; |
|
299 |
EventInitialEnvironmentVariable event(UNTIMED); |
|
300 |
event.set_endtime(time_stamp); |
|
301 |
event.set_key(key); |
|
302 |
event.set_value(value); |
|
303 |
event.commit(); |
|
304 |
} |
|
305 |
} |
|
306 |
} |
|
307 |
return OS_OK; |
|
308 |
} |
|
309 |
||
310 |
int JfrOSInterface::system_processes(SystemProcess** sys_processes, int* no_of_sys_processes) { |
|
311 |
return instance()._impl->system_processes(sys_processes, no_of_sys_processes); |
|
312 |
} |
|
50879 | 313 |
|
314 |
int JfrOSInterface::network_utilization(NetworkInterface** network_interfaces) { |
|
315 |
return instance()._impl->network_utilization(network_interfaces); |
|
316 |
} |