Hello,

I tried to get an answer to this question last year but failed.

Today, I think I have it.

Q: How do you measure swap utilization in FreeBSD? (Assuming you are writing a script to gather performance metrics.)

A: If you are writing a C program, check kvm_getswapinfo(3) and maybe take a gander at the bottom of /usr/src/usr.bin/top/machine.c.

A: If you are writing a Perl script:

Measure swap activity:
sysctl vm.stats.vm.v_swapin vm.stats.vm.v_swapout vm.stats.vm.v_swappgsin vm.stats.vm.v_swappgsout
(I believe these results are COUNTER type values, like you get from netstat -inb. You could establish "swap activity" by plotting changes in this value.)


Measure swap size:
0-13:38 [EMAIL PROTECTED] ~> swapinfo
Device          1K-blocks     Used    Avail Capacity
/dev/ad0s1b       1022224        0  1022224     0%
0-13:38 [EMAIL PROTECTED] ~> swapctl -l
Device:       1024-blocks     Used:
/dev/ad0s1b     1022224         0

If you are trying to accomodate n+1 swap devices, try this:
0-13:44 [EMAIL PROTECTED] ~> swapctl -lsk
Device:       1024-blocks      Used:
/dev/ad0s1b      1022224          0
Total:           1022224          0

Now, perhaps the next poor soul to Google this topic may get a slightly better answer. :)

Thanks,
-danny

--
http://dannyman.toldme.com/

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to