run-queue length via sysctl

Eric van Gyzen eric at vangyzen.net
Thu Aug 7 13:47:38 UTC 2014


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


More information about the freebsd-hackers mailing list