From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 7 13:47:38 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 198E71C1 for ; Thu, 7 Aug 2014 13:47:38 +0000 (UTC) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) by mx1.freebsd.org (Postfix) with ESMTP id D83942A99 for ; Thu, 7 Aug 2014 13:47:37 +0000 (UTC) Received: from marvin.beer.town (c-24-125-214-90.hsd1.va.comcast.net [24.125.214.90]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 2009156444; Thu, 7 Aug 2014 08:47:37 -0500 (CDT) Message-ID: <53E38378.60401@vangyzen.net> Date: Thu, 07 Aug 2014 09:47:36 -0400 From: Eric van Gyzen User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Stefan Parvu Subject: Re: run-queue length via sysctl References: <20140807163024.30fa15298e9dfee4661f68ec@systemdatarecorder.org> In-Reply-To: <20140807163024.30fa15298e9dfee4661f68ec@systemdatarecorder.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Aug 2014 13:47:38 -0000 On 08/07/2014 09:30, Stefan Parvu wrote: > Hi, > > I made some progress in porting 2 data recorders to FreeBSD: > cpurec, hdwrec: http://www.systemdatarecorder.org/recording/agents.html > > Im working now on sysrec and found very powerful the sysctl interface since last > time I checked in 2007 or so. > > But I could not find any way to get the value of run-queue length via sysctl. > > procs memory page disks faults cpu > r b w avm fre flt re pi po fr sr mf0 mf1 in sy cs us sy id > 0 0 0 757M 61G 6 0 0 0 12 1 0 0 9 50 135 0 0 100 > 0 0 0 757M 61G 0 0 0 0 0 1 0 0 21 140 208 0 0 100 > 0 0 0 757M 61G 0 0 0 0 0 1 0 0 3 125 94 0 0 100 > 0 0 0 757M 61G 0 0 0 0 0 1 0 0 4 125 99 0 0 100 > > I dont want to call vmstat in my script ... Any ideas how to do this ? $ sysctl vm.vmtotal vm.vmtotal: System wide totals computed every five seconds: (values in kilobytes) =============================================== Processes: (RUNQ: 2 Disk Wait: 0 Page Wait: 0 Sleep: 239) Virtual Memory: (Total: 1083133168K Active: 9251728K) Real Memory: (Total: 7492844K Active: 1953232K) Shared Virtual Memory: (Total: 122304K Active: 113348K) Shared Real Memory: (Total: 48648K Active: 48268K) Free Memory: 764348K vmstat uses the vm.vmtotal sysctl to get a struct vmtotal{} for the "r b w" columns. See fill_vmtotal() in src/usr.bin/vmstat/vmstat.c and vmtotal{} in /usr/include/sys/vmmeter.h. Eric