Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Aug 2014 09:47:36 -0400
From:      Eric van Gyzen <eric@vangyzen.net>
To:        Stefan Parvu <sparvu@systemdatarecorder.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: run-queue length via sysctl
Message-ID:  <53E38378.60401@vangyzen.net>
In-Reply-To: <20140807163024.30fa15298e9dfee4661f68ec@systemdatarecorder.org>
References:  <20140807163024.30fa15298e9dfee4661f68ec@systemdatarecorder.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53E38378.60401>