2015-02-19 14:15:38 -05:00
|
|
|
#!/bin/sh
|
2015-02-21 12:18:27 -05:00
|
|
|
|
2015-02-22 14:45:57 -05:00
|
|
|
if is_osx; then
|
2015-02-22 12:36:04 -05:00
|
|
|
collect () {
|
2015-03-11 17:02:00 -04:00
|
|
|
report $(sysctl -n vm.swapusage |
|
2015-03-12 15:59:09 -04:00
|
|
|
awk '{ if (int($3) == 0) exit; printf "%.1f", $6 / $3 * 100.0 }')
|
2015-02-22 12:36:04 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
collect () {
|
2015-03-12 15:59:09 -04:00
|
|
|
report $(free |
|
|
|
|
awk '/Swap/{ if (int($2) == 0) exit; printf "%.1f", $3 / $2 * 100.0 }')
|
2015-02-22 12:36:04 -05:00
|
|
|
}
|
2015-02-22 14:45:57 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
docs () {
|
|
|
|
echo "Percentage of used swap space."
|
|
|
|
}
|