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 *
207 return instance()._impl->cpu_load_total_process(cpu_load);
208 }
209
210 int JfrOSInterface::cpu_loads_process(double* jvm_user_load, double* jvm_kernel_load, double* system_total_load){
211 return instance()._impl->cpu_loads_process(jvm_user_load, jvm_kernel_load, system_total_load);
212 }
213
214 int JfrOSInterface::os_version(char** os_version) {
215 return instance()._impl->os_version(os_version);
216 }
217
218 const char* JfrOSInterface::virtualization_name() {
219 VirtualizationType vrt = VM_Version::get_detected_virtualization();
220 if (vrt == XenHVM) {
221 return "Xen hardware-assisted virtualization";
222 } else if (vrt == KVM) {
223 return "KVM virtualization";
224 } else if (vrt == VMWare) {
225 return "VMWare virtualization";
226 } else if (vrt == HyperV) {
227 return "HyperV virtualization";
228 } else if (vrt == PowerVM) {
229 return "PowerVM virtualization";
230 } else if (vrt == PowerKVM) {
231 return "Power KVM virtualization";
232 } else if (vrt == PowerFullPartitionMode) {
233 return "Power full partition";
234 }
235
236 return "No virtualization detected";
237 }
238
239 int JfrOSInterface::generate_initial_environment_variable_events() {
240 if (environ == NULL) {
241 return OS_ERR;
242 }
243
244 if (EventInitialEnvironmentVariable::is_enabled()) {
245 // One time stamp for all events, so they can be grouped together
246 JfrTicks time_stamp = JfrTicks::now();
247 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 *
207 return instance()._impl->cpu_load_total_process(cpu_load);
208 }
209
210 int JfrOSInterface::cpu_loads_process(double* jvm_user_load, double* jvm_kernel_load, double* system_total_load){
211 return instance()._impl->cpu_loads_process(jvm_user_load, jvm_kernel_load, system_total_load);
212 }
213
214 int JfrOSInterface::os_version(char** os_version) {
215 return instance()._impl->os_version(os_version);
216 }
217
218 const char* JfrOSInterface::virtualization_name() {
219 VirtualizationType vrt = VM_Version::get_detected_virtualization();
220 if (vrt == XenHVM) {
221 return "Xen hardware-assisted virtualization";
222 } else if (vrt == KVM) {
223 return "KVM virtualization";
224 } else if (vrt == VMWare) {
225 return "VMWare virtualization";
226 } else if (vrt == HyperV) {
227 return "Hyper-V virtualization";
228 } else if (vrt == HyperVRole) {
229 return "Hyper-V role";
230 } else if (vrt == PowerVM) {
231 return "PowerVM virtualization";
232 } else if (vrt == PowerKVM) {
233 return "Power KVM virtualization";
234 } else if (vrt == PowerFullPartitionMode) {
235 return "Power full partition";
236 }
237
238 return "No virtualization detected";
239 }
240
241 int JfrOSInterface::generate_initial_environment_variable_events() {
242 if (environ == NULL) {
243 return OS_ERR;
244 }
245
246 if (EventInitialEnvironmentVariable::is_enabled()) {
247 // One time stamp for all events, so they can be grouped together
248 JfrTicks time_stamp = JfrTicks::now();
249 for (char** p = environ; *p != NULL; p++) {
|