1*0f101429Ssevan.\" $NetBSD: kvm_getloadavg.3,v 1.13 2018/12/11 23:02:19 sevan Exp $ 2346e67f8Sthorpej.\" 30215cc7dScgd.\" Copyright (c) 1992, 1993 40215cc7dScgd.\" The Regents of the University of California. All rights reserved. 50215cc7dScgd.\" 60215cc7dScgd.\" Redistribution and use in source and binary forms, with or without 70215cc7dScgd.\" modification, are permitted provided that the following conditions 80215cc7dScgd.\" are met: 90215cc7dScgd.\" 1. Redistributions of source code must retain the above copyright 100215cc7dScgd.\" notice, this list of conditions and the following disclaimer. 110215cc7dScgd.\" 2. Redistributions in binary form must reproduce the above copyright 120215cc7dScgd.\" notice, this list of conditions and the following disclaimer in the 130215cc7dScgd.\" documentation and/or other materials provided with the distribution. 14eb7c1594Sagc.\" 3. Neither the name of the University nor the names of its contributors 150215cc7dScgd.\" may be used to endorse or promote products derived from this software 160215cc7dScgd.\" without specific prior written permission. 170215cc7dScgd.\" 180215cc7dScgd.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 190215cc7dScgd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 200215cc7dScgd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 210215cc7dScgd.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 220215cc7dScgd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 230215cc7dScgd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 240215cc7dScgd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 250215cc7dScgd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 260215cc7dScgd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 270215cc7dScgd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 280215cc7dScgd.\" SUCH DAMAGE. 290215cc7dScgd.\" 300215cc7dScgd.\" @(#)kvm_getloadavg.3 8.1 (Berkeley) 6/4/93 310215cc7dScgd.\" 32e67a3558Ssevan.Dd December 11, 2018 330215cc7dScgd.Dt KVM_GETLOADAVG 3 340215cc7dScgd.Os 350215cc7dScgd.Sh NAME 360215cc7dScgd.Nm kvm_getloadavg 37e67a3558Ssevan.Nd get system load averages, from live or dead kernels 38312aca53Sperry.Sh LIBRARY 39312aca53Sperry.Lb libkvm 400215cc7dScgd.Sh SYNOPSIS 41472351e1Swiz.In sys/resource.h 42472351e1Swiz.In kvm.h 430215cc7dScgd.Ft int 440215cc7dScgd.Fn kvm_getloadavg "kvm_t *kd" "double loadavg[]" "int nelem" 450215cc7dScgd.Sh DESCRIPTION 460215cc7dScgdThe 470215cc7dScgd.Fn kvm_getloadavg 480215cc7dScgdfunction returns the number of processes in the system run queue 49e67a3558Ssevanof the kernel or core file, indicated by 50e67a3558Ssevan.Fa kd . 510215cc7dScgdUp to 520215cc7dScgd.Fa nelem 530215cc7dScgdsamples are retrieved and assigned to successive elements of 540215cc7dScgd.Fa loadavg Ns Bq . 550215cc7dScgdThe system imposes a maximum of 3 samples, representing averages 560215cc7dScgdover the last 1, 5, and 15 minutes, respectively. 57e67a3558SsevanOn a live system, the load average is obtained by calling 58e67a3558Ssevan.Xr getloadavg 3 . 59e67a3558SsevanIf performing post mortem on a kernel core file, 60e67a3558Ssevan.Nm 61*0f101429Ssevanis able to extract the system load averages at the time of death from the core 62*0f101429Ssevanfile directly. 63356b12baSyamt.Sh RETURN VALUES 640215cc7dScgdIf the load average was unobtainable, \-1 is returned; otherwise, 650215cc7dScgdthe number of samples actually retrieved is returned. 660215cc7dScgd.Sh SEE ALSO 670215cc7dScgd.Xr uptime 1 , 6850adf617Swiz.Xr getloadavg 3 , 690215cc7dScgd.Xr kvm 3 , 70ea5c1879Ssimonb.Xr kvm_open 3 , 7150adf617Swiz.Xr sysctl 3 72