dannyman.toldme.com

About Me : Free Style : Good Reads : News and Reaction : Photographs : Technical : Travels : Unsorted

Search:
April 5, 2005
FreeBSD, Technical

FAQ: How do you measure swap utilization in FreeBSD?

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 djh@mito ~> swapinfo
Device          1K-blocks     Used    Avail Capacity
/dev/ad0s1b       1022224        0  1022224     0%
0-13:38 djh@mito ~> 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 djh@mito ~> swapctl -lsk
Device:       1024-blocks      Used:
/dev/ad0s1b      1022224          0
Total:           1022224          0

Read More

Next:
Previous:
Categories: FreeBSD, Technical
Possibly-Related Posts
“Tweet”
Transit Etiquette
Week of 10 January, 2010
Technology Companies: 2008 Profit-per-Employee

Comment

Leave a comment . . .

  1. You must provide an e-mail address.
  2. First-time comments will be held for review.
  3. Bogus e-mail addresses are lame, but will work.
  4. For private messages, e-mail me: dannyman@toldme.com.
  5. I will not spam you, and I will not publish or share your e-mail address.