1 /*
2 * Copyright (c) 2012, 2019, 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 *
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
259 const char* JfrOSInterface::virtualization_name() {
260 VirtualizationType vrt = VM_Version::get_detected_virtualization();
261 if (vrt == XenHVM) {
262 return "Xen hardware-assisted virtualization";
263 } else if (vrt == KVM) {
264 return "KVM virtualization";
265 } else if (vrt == VMWare) {
266 return "VMWare virtualization";
267 } else if (vrt == HyperV) {
268 return "HyperV virtualization";
269 } else if (vrt == PowerVM) {
270 return "PowerVM virtualization";
271 } else if (vrt == PowerKVM) {
272 return "Power KVM virtualization";
273 } else if (vrt == PowerFullPartitionMode) {
274 return "Power full partition";
275 }
276
277 return "No virtualization detected";
278 }
279
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++) {
|
1 /*
2 * Copyright (c) 2012, 2020, 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 *
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
259 const char* JfrOSInterface::virtualization_name() {
260 VirtualizationType vrt = VM_Version::get_detected_virtualization();
261 if (vrt == XenHVM) {
262 return "Xen hardware-assisted virtualization";
263 } else if (vrt == KVM) {
264 return "KVM virtualization";
265 } else if (vrt == VMWare) {
266 return "VMWare virtualization";
267 } else if (vrt == HyperV) {
268 return "Hyper-V virtualization";
269 } else if (vrt == HyperVRole) {
270 return "Hyper-V role";
271 } else if (vrt == PowerVM) {
272 return "PowerVM virtualization";
273 } else if (vrt == PowerKVM) {
274 return "Power KVM virtualization";
275 } else if (vrt == PowerFullPartitionMode) {
276 return "Power full partition";
277 }
278
279 return "No virtualization detected";
280 }
281
282 int JfrOSInterface::generate_initial_environment_variable_events() {
283 if (environ == NULL) {
284 return OS_ERR;
285 }
286
287 if (EventInitialEnvironmentVariable::is_enabled()) {
288 // One time stamp for all events, so they can be grouped together
289 JfrTicks time_stamp = JfrTicks::now();
290 for (char** p = environ; *p != NULL; p++) {
|