4162N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 4162N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4162N/A * This code is free software; you can redistribute it and/or modify it 4162N/A * under the terms of the GNU General Public License version 2 only, as 4162N/A * published by the Free Software Foundation. Oracle designates this 4162N/A * particular file as subject to the "Classpath" exception as provided 4162N/A * by Oracle in the LICENSE file that accompanied this code. 4162N/A * This code is distributed in the hope that it will be useful, but WITHOUT 4162N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4162N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4162N/A * version 2 for more details (a copy is included in the LICENSE file that 4162N/A * You should have received a copy of the GNU General Public License version 4162N/A * 2 along with this work; if not, write to the Free Software Foundation, 4162N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4162N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4162N/A // Data structure for saving CPU load 4162N/A // Get kstat cpu_stat counters for every CPU 4162N/A // (loop over kstat to find our cpu_stat(s) 4162N/A // Failed to initialize kstat for this CPU so ignore it 4162N/A // Found more cpu_stats than reported CPUs 4162N/A // Concurrence in this method is prevented by the lock in 4162N/A // the calling method get_cpu_load(); 4162N/A // disabling for now, a kstat chain update is likely to happen next time 4162N/A // Calculate diff against previous snapshot 4162N/A /** update if weve moved */ 4162N/A // Save current values for next time around 4162N/A * Return the cpu load (0-1) for proc number 'which' (or average all if which == -1) 4162N/A // Cap total systemload to 1.0 4162N/A * Return the cpu load (0-1) for the current process (i.e the JVM) 4162N/A * or -1.0 if the get_info() call failed 4162N/A // Get the percentage of "recent cpu usage" from all the lwp:s in the JVM:s 4162N/A // process. This is returned as a value between 0.0 and 1.0 multiplied by 0x8000.